Gastos_casa %>% 
  dplyr::select(-Tiempo,-link) %>%
  dplyr::select(fecha, gasto, monto, gastador,obs) %>% tail(30) %>%
  knitr::kable(.,format = "html", format.args = list(decimal.mark = ",", big.mark = "."),
                   caption="Tabla 1. Gastos Casa (últimos 30 registros)", align =rep('c', 3)) %>%
    kableExtra::kable_styling(bootstrap_options = c("striped", "hover"),font_size = 8) %>%
    kableExtra::scroll_box(width = "100%", height = "300px")
Tabla 1. Gastos Casa (últimos 30 registros)
fecha gasto monto gastador obs
12/5/2022 Comida 28.790 Andrés cafe musetti
10/5/2022 Enceres 18.230 Andrés Compraste Quinoa Fusión Banquete 400g y 1 producto más
15/5/2022 Enceres 13.380 Tami Sensodyne
18/5/2022 Comida 41.970 Tami NA
19/5/2022 VTR 21.990 Andrés NA
21/5/2022 Pila estufa 6.414 Andrés Pila cr2 switchbot
25/5/2022 Reloj 8.914 Andrés Reloj alarma temperatura y humedad
28/5/2022 Comida 138.918 Tami Wild Foods
29/5/2022 Parafina 42.490 Tami NA
30/5/2022 Comida 50.346 Tami NA
30/5/2022 Netflix 8.320 Tami NA
1/6/2022 Diosi 7.000 Andrés Pilas collar
3/6/2022 Electricidad 24.792 Andrés Pac enel 01686518
6/6/2022 Enceres 19.400 Tami Caja Papel Higiénico
7/6/2022 Comida 15.260 Andrés NA
7/6/2022 Comida 23.450 Andrés NA
13/6/2022 Comida 57.775 Tami NA
18/6/2022 Gas 81.350 Andrés NA
19/6/2022 VTR 21.990 Andrés NA
20/6/2022 Electricidad 67.655 Andrés NA
21/6/2022 Comida 38.000 Andrés NA
21/6/2022 Comida 15.000 Andrés Flor de loto verduras
24/6/2022 Comida 40.400 Andrés Bar la Providencia
27/6/2022 Agua 12.502 Andrés PAC AGUAS ANDIN 000000005687837
29/6/2022 Netflix 8.320 Tami NA
29/6/2022 Comida 68.213 Tami NA
30/6/2022 Comida 15.310 Tami NA
30/6/2022 Electricidad 67.655 Andrés NA
31/3/2019 Comida 9.000 Andrés NA
8/9/2019 Comida 24.588 Andrés Super Lider

#para ver las diferencias depués de la diosi
Gastos_casa %>%
    dplyr::mutate(fecha= lubridate::parse_date_time(fecha, c("%d/%m/%Y"),exact=T)) %>% 
    dplyr::mutate(fecha=strftime(fecha, format = "%Y-W%V")) %>%
    dplyr::mutate(gastador=ifelse(gastador=="Andrés",1,0)) %>%
    dplyr::group_by(gastador, fecha,.drop = F) %>% 
    dplyr::summarise(gasto_media=mean(monto,na.rm=T)) %>% 
    dplyr::mutate(treat=ifelse(fecha>"2019-W26",1,0)) %>%
    #dplyr::mutate(fecha_simp=lubridate::week(fecha)) %>%#después de  diosi. Junio 24, 2019 
    dplyr::mutate(gastador_nombre=plyr::revalue(as.character(gastador), c("0" = "Tami", "1"="Andrés"))) %>% 
    assign("ts_gastos_casa_week_treat", ., envir = .GlobalEnv) 

gplots::plotmeans(gasto_media ~ gastador_nombre, main="Promedio de gasto por gastador", data=ts_gastos_casa_week_treat,ylim=c(0,75000), xlab="", ylab="")

par(mfrow=c(1,2)) 
gplots::plotmeans(gasto_media ~ gastador_nombre, main="Antes de Diosi", data=ts_gastos_casa_week_treat[ts_gastos_casa_week_treat$treat==0,], xlab="", ylab="", ylim=c(0,70000))

gplots::plotmeans(gasto_media ~ gastador_nombre, main="Después de Diosi", data=ts_gastos_casa_week_treat[ts_gastos_casa_week_treat$treat==1,], xlab="", ylab="",ylim=c(0,70000))

library(ggiraph)
library(scales)
#if( requireNamespace("dplyr", quietly = TRUE)){
gg <- Gastos_casa %>%
  dplyr::mutate(fecha= lubridate::parse_date_time(fecha, c("%d/%m/%Y"),exact=T)) %>% 
  dplyr::mutate(gastador=ifelse(gastador=="Andrés",1,0)) %>%
  dplyr::mutate(fecha_simp=tsibble::yearweek(fecha)) %>%
  dplyr::mutate(fecha_week=strftime(fecha, format = "%Y-W%V")) %>%
  dplyr::mutate(treat=ifelse(fecha_week>"2019 W26",1,0)) %>%
  dplyr::mutate(gastador_nombre=plyr::revalue(as.character(gastador), c("0" = "Tami", "1"="Andrés"))) %>% 
#  dplyr::mutate(week=as.Date(as.character(lubridate::floor_date(fecha, "week"))))%>%
  #dplyr::mutate(fecha_week= lubridate::parse_date_time(fecha_week, c("%Y-W%V"),exact=T)) %>% 
  dplyr::group_by(gastador_nombre, fecha_simp) %>%
  summarise(monto_total=sum(monto)) %>%
  dplyr::mutate(tooltip= paste0(substr(gastador_nombre,1,1),"=",round(monto_total/1000,2))) %>%
  ggplot(aes(hover_css = "fill:none;")) +#, ) +
  #stat_summary(geom = "line", fun.y = median, size = 1, alpha=0.5, aes(color="blue")) +
  geom_line(aes(x = fecha_simp, y = monto_total, color=as.factor(gastador_nombre)),size=1,alpha=.5) +
                       ggiraph::geom_point_interactive(aes(x = fecha_simp, y = monto_total, color=as.factor(gastador_nombre),tooltip=tooltip),size = 1) +
  #geom_text(aes(x = fech_ing_qrt, y = perc_dup-0.05, label = paste0(n)), vjust = -1,hjust = 0, angle=45, size=3) +
 # guides(color = F)+
  sjPlot::theme_sjplot2() +
  geom_vline(xintercept = as.Date("2019-06-24"),linetype = "dashed") +
  labs(y="Gastos (en miles)",x="Semanas y Meses", subtitle="Interlineado, incorporación de la Diosi; Azul= Tami; Rojo= Andrés") + ggtitle( "Figura 4. Gastos por Gastador") +
  scale_y_continuous(labels = f <- function(x) paste0(x/1000)) + 
  scale_color_manual(name = "Gastador", values= c("blue", "red"), labels = c("Tami", "Andrés")) +
  scale_x_yearweek(date_breaks = "1 month", minor_breaks = "1 week", labels=scales::date_format("%m/%y")) +
  theme(axis.text.x = element_text(vjust = 0.5,angle = 35), legend.position='bottom')+
     theme(
    panel.border = element_blank(), 
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(), 
    axis.line = element_line(colour = "black")
    )

#  x <- girafe(ggobj = gg)
#  x <- girafe_options(x = x,
#                      opts_hover(css = "stroke:red;fill:orange") )
#  if( interactive() ) print(x)

#}
tooltip_css <- "background-color:gray;color:white;font-style:italic;padding:10px;border-radius:10px 20px 10px 20px;"

#ggiraph(code = {print(gg)}, tooltip_extra_css = tooltip_css, tooltip_opacity = .75 )

x <- girafe(ggobj = gg)
x <- girafe_options(x,
  opts_zoom(min = 1, max = 3), opts_hover(css =tooltip_css))
x
plot<-Gastos_casa %>%
    dplyr::mutate(fecha= lubridate::parse_date_time(fecha, c("%d/%m/%Y"),exact=T)) %>% 
    dplyr::mutate(fecha_week=strftime(fecha, format = "%Y-W%V")) %>%
    dplyr::mutate(month=as.Date(as.character(lubridate::floor_date(fecha, "month"))))%>%
    dplyr::group_by(month)%>%
    summarise(gasto_total=sum(monto)/1000) %>%
      ggplot2::ggplot(aes(x = month, y = gasto_total)) +
      geom_point()+
      geom_line(size=1) +
      sjPlot::theme_sjplot2() +
      geom_vline(xintercept = as.Date("2019-06-24"),linetype = "dashed") +
      geom_vline(xintercept = as.Date("2019-03-23"),linetype = "dashed", color="red") +
      labs(y="Gastos (en miles)",x="Meses/Año", subtitle="Interlineado, incorporación de la Diosi") + 
      ggtitle( "Figura 5. Suma de Gastos por Mes") +        
      scale_x_date(breaks = "1 month", minor_breaks = "1 month", labels=scales::date_format("%m/%y")) +
      theme(axis.text.x = element_text(vjust = 0.5,angle = 45)) 
plotly::ggplotly(plot)  
plot2<-Gastos_casa %>%
    dplyr::mutate(fecha= lubridate::parse_date_time(fecha, c("%d/%m/%Y"),exact=T)) %>% 
    dplyr::mutate(fecha_week=strftime(fecha, format = "%Y-W%V")) %>%
    dplyr::mutate(day=as.Date(as.character(lubridate::floor_date(fecha, "day"))))%>%
    dplyr::group_by(day)%>%
    summarise(gasto_total=sum(monto)/1000) %>%
      ggplot2::ggplot(aes(x = day, y = gasto_total)) +
      geom_line(size=1) +
      sjPlot::theme_sjplot2() +
      geom_vline(xintercept = as.Date("2019-06-24"),linetype = "dashed") +
      geom_vline(xintercept = as.Date("2020-03-23"),linetype = "dashed", color="red") +
      labs(y="Gastos (en miles)",x="Meses/Año", subtitle="Interlineado, incorporación de la Diosi") + 
      ggtitle( "Figura 5. Suma de Gastos por Día") +        
      scale_x_date(breaks = "1 month", minor_breaks = "1 week", labels=scales::date_format("%m/%y")) +
      theme(axis.text.x = element_text(vjust = 0.5,angle = 45)) 
plotly::ggplotly(plot2)  
tsData <- Gastos_casa %>%
    dplyr::mutate(fecha= lubridate::parse_date_time(fecha, c("%d/%m/%Y"),exact=T)) %>% 
    dplyr::mutate(fecha_week=strftime(fecha, format = "%Y-W%V")) %>%
    dplyr::mutate(day=as.Date(as.character(lubridate::floor_date(fecha, "day"))))%>%
    dplyr::group_by(day)%>%
    summarise(gasto_total=sum(monto))%>%
    dplyr::mutate(covid=case_when(day>as.Date("2019-06-02")~1,TRUE~0))%>%
    dplyr::mutate(covid=case_when(day>as.Date("2020-03-10")~covid+1,TRUE~covid))%>%
    dplyr::mutate(covid=as.factor(covid))%>%
  data.frame()

  
tsData_gastos <-ts(tsData$gasto_total, frequency=7)
mstsData_gastos <- forecast::msts(Gastos_casa$monto, seasonal.periods=c(7,30))
  tsData_gastos = decompose(tsData_gastos)
#plot(tsData_Santiago, title="Descomposición del número de casos confirmados para Santiago")
forecast::autoplot(tsData_gastos, main="Decomposición de los Gastos Diarios")+
    theme_bw()+ labs(x="Weeks")

tsdata_gastos_trend<-cbind(tsData,trend=as.vector(tsData_gastos$trend))%>% na.omit()
#tsData_gastos$trend
#Using the inputted variables, a Type-2 Sum Squares ANCOVA Lagged Dependent Variable model is fitted which estimates the difference in means between interrupted and non-interrupted time periods, while accounting for the lag of the dependent variable and any further specified covariates.
#Typically such analyses use Auto-regressive Integrated Moving Average (ARIMA) models to handle the serial dependence of the residuals of a linear model, which is estimated either as part of the ARIMA process or through a standard linear regression modeling process [9,17]. All such time series methods enable the effect of the event to be separated from general trends and serial dependencies in time, thereby enabling valid statistical inferences to be made about whether an intervention has had an effect on a time series.
   #it uses Type-2 Sum Squares ANCOVA Lagged Dependent Variable model
   #ITSA model da cuenta de observaciones autocorrelacionadas e impactos dinámicos mediante una regresión de deltas en rezagados. Una vez que se incorporan en el modelo, se controlan. 
#residual autocorrelation assumptions
#TSA allows the model to account for baseline levels and trends present in the data therefore allowing us to attribute significant changes to the interruption
#RDestimate(all~agecell,data=metro_region,cutpoint = 21)

#Ver con CHANGEPOINT
##http://www.lancs.ac.uk/~killick/Pub/KillickEckley2011.pdf

itsa_metro_region_quar<-
        its.analysis::itsa.model(time = "day", depvar = "gasto_total",data=tsData,
                                 interrupt_var = "covid", 
                                 alpha = 0.05,no.plots = F, bootstrap = TRUE, Reps = 10000, print = F) 

print(itsa_metro_region_quar)
## [[1]]
## [1] "ITSA Model Fit"
## 
## $aov.result
## Anova Table (Type II tests)
## 
## Response: depvar
##                   Sum Sq  Df F value Pr(>F)    
## interrupt_var 4.8968e+10   2 19.4334 <2e-16 ***
## lag_depvar    7.7414e+08   1  0.6144 0.4335    
## Residuals     5.8459e+11 464                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## $tukey.result
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: stats::aov(formula = x$depvar ~ x$interrupt_var)
## 
## $`x$interrupt_var`
##          diff       lwr      upr     p adj
## 1-0  8373.715 -7002.807 23750.24 0.4069353
## 2-0 29375.415 15199.192 43551.64 0.0000045
## 2-1 21001.700 12028.626 29974.77 0.0000002
## 
## 
## $data
##     depvar interrupt_var lag_depvar
## 2     2800             0       4780
## 3     4250             0       2800
## 4    11480             0       4250
## 5    38254             0      11480
## 6     3300             0      38254
## 7    47206             0       3300
## 8    27595             0      47206
## 9    36888             0      27595
## 10    1990             0      36888
## 11   30338             0       1990
## 12   16880             0      30338
## 13    9040             0      16880
## 14    9000             0       9040
## 15   25484             0       9000
## 16   15595             0      25484
## 17    8220             0      15595
## 18    4130             0       8220
## 19   17290             0       4130
## 20   14366             0      17290
## 21   22595             0      14366
## 22   12022             0      22595
## 23   23886             0      12022
## 24    3200             0      23886
## 25   60883             0       3200
## 26    9950             0      60883
## 27   10198             0       9950
## 28   37740             0      10198
## 29    6621             0      37740
## 30   29115             0       6621
## 31   17992             0      29115
## 32   12230             0      17992
## 33   23782             0      12230
## 34   73000             0      23782
## 35   38202             0      73000
## 36    4000             0      38202
## 37   10119             0       4000
## 38   29230             0      10119
## 39   43025             0      29230
## 40   26574             0      43025
## 41   84292             1      26574
## 42   18254             1      84292
## 43   31900             1      18254
## 44   35826             1      31900
## 45    5640             1      35826
## 46   17470             1       5640
## 47   17341             1      17470
## 48    8804             1      17341
## 49   78503             1       8804
## 50   51424             1      78503
## 51   44554             1      51424
## 52   60435             1      44554
## 53   13420             1      60435
## 54   54700             1      13420
## 55   42750             1      54700
## 56   19990             1      42750
## 57    7900             1      19990
## 58    4670             1       7900
## 59    5500             1       4670
## 60   63823             1       5500
## 61   27300             1      63823
## 62   13082             1      27300
## 63   55315             1      13082
## 64   17993             1      55315
## 65    7050             1      17993
## 66    8800             1       7050
## 67   30736             1       8800
## 68  160249             1      30736
## 69   27858             1     160249
## 70   17220             1      27858
## 71   51704             1      17220
## 72   46440             1      51704
## 73   94286             1      46440
## 74   14820             1      94286
## 75   42000             1      14820
## 76    7872             1      42000
## 77   41403             1       7872
## 78    6030             1      41403
## 79    9998             1       6030
## 80   19791             1       9998
## 81   40474             1      19791
## 82    9352             1      40474
## 83   24588             1       9352
## 84     500             1      24588
## 85   22180             1        500
## 86    3800             1      22180
## 87   12000             1       3800
## 88   25000             1      12000
## 89   19591             1      25000
## 90   53500             1      19591
## 91   35900             1      53500
## 92   30112             1      35900
## 93    4000             1      30112
## 94   16942             1       4000
## 95   58055             1      16942
## 96   10220             1      58055
## 97   61508             1      10220
## 98   20390             1      61508
## 99   23700             1      20390
## 100   6950             1      23700
## 101  20200             1       6950
## 102   6590             1      20200
## 103  34380             1       6590
## 104   5660             1      34380
## 105  11224             1       5660
## 106   8000             1      11224
## 107   9352             1       8000
## 108  25628             1       9352
## 109  42430             1      25628
## 110  27036             1      42430
## 111  33795             1      27036
## 112   9541             1      33795
## 113  21431             1       9541
## 114  32404             1      21431
## 115   5580             1      32404
## 116  13931             1       5580
## 117  29243             1      13931
## 118  55000             1      29243
## 119  96600             1      55000
## 120   6950             1      96600
## 121  47128             1       6950
## 122  29606             1      47128
## 123  29604             1      29606
## 124  10720             1      29604
## 125  13500             1      10720
## 126  67283             1      13500
## 127  23640             1      67283
## 128  33345             1      23640
## 129  39074             1      33345
## 130  90502             1      39074
## 131   7855             1      90502
## 132   5980             1       7855
## 133  42150             1       5980
## 134  37913             1      42150
## 135  76599             1      37913
## 136  34589             1      76599
## 137  20000             1      34589
## 138  17990             1      20000
## 139  31540             1      17990
## 140  13388             1      31540
## 141  24990             1      13388
## 142  69267             1      24990
## 143   7000             1      69267
## 144  31334             1       7000
## 145  16144             1      31334
## 146  13000             1      16144
## 147  29610             1      13000
## 148  13970             1      29610
## 149  18000             1      13970
## 150  31284             1      18000
## 151  13919             1      31284
## 152  40000             1      13919
## 153  17327             1      40000
## 154  42354             1      17327
## 155  15429             1      42354
## 156  31255             1      15429
## 157  41707             1      31255
## 158  38216             1      41707
## 159   3702             1      38216
## 160  11421             1       3702
## 161  22764             2      11421
## 162  62659             2      22764
## 163  99054             2      62659
## 164  28327             2      99054
## 165  17101             2      28327
## 166  43930             2      17101
## 167  22708             2      43930
## 168  50136             2      22708
## 169  26327             2      50136
## 170  61450             2      26327
## 171  71800             2      61450
## 172 147732             2      71800
## 173  61656             2     147732
## 174  10000             2      61656
## 175  24700             2      10000
## 176  13500             2      24700
## 177  83106             2      13500
## 178  63980             2      83106
## 179  85968             2      63980
## 180  84281             2      85968
## 181  39990             2      84281
## 182  24990             2      39990
## 183  70624             2      24990
## 184   7000             2      70624
## 185  37945             2       7000
## 186  12317             2      37945
## 187  16485             2      12317
## 188  68102             2      16485
## 189 105950             2      68102
## 190  66265             2     105950
## 191  54700             2      66265
## 192  83980             2      54700
## 193  98722             2      83980
## 194  58817             2      98722
## 195  17577             2      58817
## 196 107500             2      17577
## 197 122920             2     107500
## 198  20055             2     122920
## 199  48104             2      20055
## 200  12532             2      48104
## 201  10980             2      12532
## 202  28990             2      10980
## 203  72200             2      28990
## 204  60168             2      72200
## 205  71537             2      60168
## 206  33900             2      71537
## 207   9631             2      33900
## 208  14813             2       9631
## 209  83431             2      14813
## 210 143430             2      83431
## 211  57200             2     143430
## 212  85358             2      57200
## 213  47168             2      85358
## 214  40010             2      47168
## 215  90669             2      40010
## 216  19990             2      90669
## 217  48788             2      19990
## 218  14000             2      48788
## 219  13211             2      14000
## 220  22790             2      13211
## 221  64960             2      22790
## 222  10700             2      64960
## 223 156000             2      10700
## 224 107450             2     156000
## 225  21227             2     107450
## 226 195632             2      21227
## 227  82848             2     195632
## 228  81012             2      82848
## 229  71530             2      81012
## 230  83489             2      71530
## 231  59359             2      83489
## 232  17877             2      59359
## 233 168788             2      17877
## 234  76129             2     168788
## 235 118970             2      76129
## 236  82462             2     118970
## 237  38900             2      82462
## 238  21000             2      38900
## 239  63180             2      21000
## 240  61796             2      63180
## 241  12317             2      61796
## 242  54470             2      12317
## 243  15245             2      54470
## 244  72490             2      15245
## 245  38250             2      72490
## 246  10700             2      38250
## 247  11150             2      10700
## 248  94711             2      11150
## 249   8370             2      94711
## 250  46782             2       8370
## 251  10500             2      46782
## 252  27880             2      10500
## 253  39990             2      27880
## 254  33778             2      39990
## 255  21227             2      33778
## 256  55952             2      21227
## 257  77243             2      55952
## 258  52126             2      77243
## 259  49662             2      52126
## 260  35924             2      49662
## 261 116320             2      35924
## 262 161433             2     116320
## 263  54470             2     161433
## 264  23641             2      54470
## 265  64000             2      23641
## 266  19379             2      64000
## 267  47512             2      19379
## 268  66300             2      47512
## 269  75490             2      66300
## 270  22637             2      75490
## 271  25319             2      22637
## 272  32803             2      25319
## 273  89927             2      32803
## 274  17648             2      89927
## 275  99528             2      17648
## 276  60398             2      99528
## 277  55229             2      60398
## 278  27691             2      55229
## 279  81021             2      27691
## 280  70970             2      81021
## 281  95158             2      70970
## 282  50847             2      95158
## 283  62081             2      50847
## 284  42000             2      62081
## 285  73709             2      42000
## 286  30783             2      73709
## 287  43436             2      30783
## 288  11440             2      43436
## 289  38000             2      11440
## 290 200164             2      38000
## 291  86313             2     200164
## 292  76990             2      86313
## 293  10090             2      76990
## 294  36123             2      10090
## 295  43500             2      36123
## 296  69333             2      43500
## 297  47888             2      69333
## 298   7000             2      47888
## 299  29000             2       7000
## 300  92796             2      29000
## 301  62100             2      92796
## 302  36400             2      62100
## 303 263220             2      36400
## 304  95529             2     263220
## 305  12350             2      95529
## 306  65960             2      12350
## 307  78361             2      65960
## 308  22277             2      78361
## 309  64180             2      22277
## 310  62082             2      64180
## 311  65569             2      62082
## 312   9784             2      65569
## 313  16200             2       9784
## 314  56000             2      16200
## 315  51151             2      56000
## 316   4500             2      51151
## 317  51842             2       4500
## 318  21990             2      51842
## 319  40110             2      21990
## 320   9640             2      40110
## 321  86702             2       9640
## 322  35000             2      86702
## 323 211129             2      35000
## 324  34543             2     211129
## 325  35000             2      34543
## 326 104200             2      35000
## 327  28770             2     104200
## 328 290890             2      28770
## 329  22000             2     290890
## 330  17453             2      22000
## 331  24910             2      17453
## 332  21837             2      24910
## 333  39708             2      21837
## 334   5710             2      39708
## 335  50082             2       5710
## 336  51549             2      50082
## 337  20975             2      51549
## 338  43500             2      20975
## 339  16555             2      43500
## 340  85920             2      16555
## 341  14329             2      85920
## 342  12000             2      14329
## 343  45254             2      12000
## 344  21990             2      45254
## 345   5990             2      21990
## 346  64626             2       5990
## 347  91236             2      64626
## 348  16400             2      91236
## 349  19018             2      16400
## 350  59565             2      19018
## 351  36590             2      59565
## 352   4000             2      36590
## 353   8090             2       4000
## 354  15654             2       8090
## 355  59228             2      15654
## 356   9891             2      59228
## 357  56280             2       9891
## 358  17490             2      56280
## 359  41493             2      17490
## 360  38174             2      41493
## 361  51422             2      38174
## 362  44716             2      51422
## 363  19990             2      44716
## 364  73416             2      19990
## 365  76750             2      73416
## 366  45905             2      76750
## 367  39790             2      45905
## 368  71160             2      39790
## 369  24550             2      71160
## 370  15539             2      24550
## 371  14480             2      15539
## 372  54287             2      14480
## 373  15270             2      54287
## 374  21990             2      15270
## 375  39570             2      21990
## 376  82950             2      39570
## 377  33865             2      82950
## 378  77669             2      33865
## 379   5980             2      77669
## 380  10840             2       5980
## 381  10269             2      10840
## 382  35826             2      10269
## 383   9770             2      35826
## 384  70711             2       9770
## 385  21990             2      70711
## 386  71844             2      21990
## 387  93642             2      71844
## 388  38840             2      93642
## 389  21990             2      38840
## 390  25730             2      21990
## 391 120555             2      25730
## 392  98000             2     120555
## 393  17444             2      98000
## 394  49314             2      17444
## 395  36666             2      49314
## 396  81125             2      36666
## 397  29924             2      81125
## 398 190020             2      29924
## 399  10700             2     190020
## 400  30000             2      10700
## 401  45789             2      30000
## 402  32530             2      45789
## 403  69000             2      32530
## 404  20000             2      69000
## 405  83912             2      20000
## 406  79500             2      83912
## 407  21990             2      79500
## 408  37505             2      21990
## 409  83826             2      37505
## 410   9240             2      83826
## 411  14480             2       9240
## 412  70503             2      14480
## 413  44860             2      70503
## 414  12620             2      44860
## 415  21990             2      12620
## 416  36500             2      21990
## 417  72328             2      36500
## 418  37930             2      72328
## 419  27810             2      37930
## 420   5500             2      27810
## 421 131793             2       5500
## 422  52800             2     131793
## 423  67987             2      52800
## 424  11980             2      67987
## 425   8467             2      11980
## 426  17200             2       8467
## 427  34240             2      17200
## 428  38990             2      34240
## 429  50630             2      38990
## 430  21980             2      50630
## 431  56774             2      21980
## 432  75200             2      56774
## 433  72430             2      75200
## 434   8320             2      72430
## 435  15500             2       8320
## 436  25990             2      15500
## 437  21084             2      25990
## 438  28549             2      21084
## 439  44255             2      28549
## 440  50265             2      44255
## 441  20950             2      50265
## 442  30320             2      20950
## 443  10000             2      30320
## 444  60079             2      10000
## 445  78277             2      60079
## 446  18230             2      78277
## 447  47909             2      18230
## 448  45042             2      47909
## 449  13380             2      45042
## 450  41970             2      13380
## 451  21990             2      41970
## 452   6414             2      21990
## 453   8914             2       6414
## 454 138918             2       8914
## 455  42490             2     138918
## 456  58666             2      42490
## 457   7000             2      58666
## 458  24792             2       7000
## 459  19400             2      24792
## 460  38710             2      19400
## 461  57775             2      38710
## 462  81350             2      57775
## 463  21990             2      81350
## 464  67655             2      21990
## 465  53000             2      67655
## 466  40400             2      53000
## 467  12502             2      40400
## 468  76533             2      12502
## 469  82965             2      76533
## 
## $alpha
## [1] 0.05
## 
## $itsa.result
## [1] "Significant variation between time periods with chosen alpha"
## 
## $group.means
##   interrupt_var count     mean     s.d.
## 1             0    40 20581.25 16591.08
## 2             1   120 29360.12 24311.11
## 3             2   309 50361.83 40474.01
## 
## $dependent
##   [1]   2800   4250  11480  38254   3300  47206  27595  36888   1990  30338
##  [11]  16880   9040   9000  25484  15595   8220   4130  17290  14366  22595
##  [21]  12022  23886   3200  60883   9950  10198  37740   6621  29115  17992
##  [31]  12230  23782  73000  38202   4000  10119  29230  43025  26574  84292
##  [41]  18254  31900  35826   5640  17470  17341   8804  78503  51424  44554
##  [51]  60435  13420  54700  42750  19990   7900   4670   5500  63823  27300
##  [61]  13082  55315  17993   7050   8800  30736 160249  27858  17220  51704
##  [71]  46440  94286  14820  42000   7872  41403   6030   9998  19791  40474
##  [81]   9352  24588    500  22180   3800  12000  25000  19591  53500  35900
##  [91]  30112   4000  16942  58055  10220  61508  20390  23700   6950  20200
## [101]   6590  34380   5660  11224   8000   9352  25628  42430  27036  33795
## [111]   9541  21431  32404   5580  13931  29243  55000  96600   6950  47128
## [121]  29606  29604  10720  13500  67283  23640  33345  39074  90502   7855
## [131]   5980  42150  37913  76599  34589  20000  17990  31540  13388  24990
## [141]  69267   7000  31334  16144  13000  29610  13970  18000  31284  13919
## [151]  40000  17327  42354  15429  31255  41707  38216   3702  11421  22764
## [161]  62659  99054  28327  17101  43930  22708  50136  26327  61450  71800
## [171] 147732  61656  10000  24700  13500  83106  63980  85968  84281  39990
## [181]  24990  70624   7000  37945  12317  16485  68102 105950  66265  54700
## [191]  83980  98722  58817  17577 107500 122920  20055  48104  12532  10980
## [201]  28990  72200  60168  71537  33900   9631  14813  83431 143430  57200
## [211]  85358  47168  40010  90669  19990  48788  14000  13211  22790  64960
## [221]  10700 156000 107450  21227 195632  82848  81012  71530  83489  59359
## [231]  17877 168788  76129 118970  82462  38900  21000  63180  61796  12317
## [241]  54470  15245  72490  38250  10700  11150  94711   8370  46782  10500
## [251]  27880  39990  33778  21227  55952  77243  52126  49662  35924 116320
## [261] 161433  54470  23641  64000  19379  47512  66300  75490  22637  25319
## [271]  32803  89927  17648  99528  60398  55229  27691  81021  70970  95158
## [281]  50847  62081  42000  73709  30783  43436  11440  38000 200164  86313
## [291]  76990  10090  36123  43500  69333  47888   7000  29000  92796  62100
## [301]  36400 263220  95529  12350  65960  78361  22277  64180  62082  65569
## [311]   9784  16200  56000  51151   4500  51842  21990  40110   9640  86702
## [321]  35000 211129  34543  35000 104200  28770 290890  22000  17453  24910
## [331]  21837  39708   5710  50082  51549  20975  43500  16555  85920  14329
## [341]  12000  45254  21990   5990  64626  91236  16400  19018  59565  36590
## [351]   4000   8090  15654  59228   9891  56280  17490  41493  38174  51422
## [361]  44716  19990  73416  76750  45905  39790  71160  24550  15539  14480
## [371]  54287  15270  21990  39570  82950  33865  77669   5980  10840  10269
## [381]  35826   9770  70711  21990  71844  93642  38840  21990  25730 120555
## [391]  98000  17444  49314  36666  81125  29924 190020  10700  30000  45789
## [401]  32530  69000  20000  83912  79500  21990  37505  83826   9240  14480
## [411]  70503  44860  12620  21990  36500  72328  37930  27810   5500 131793
## [421]  52800  67987  11980   8467  17200  34240  38990  50630  21980  56774
## [431]  75200  72430   8320  15500  25990  21084  28549  44255  50265  20950
## [441]  30320  10000  60079  78277  18230  47909  45042  13380  41970  21990
## [451]   6414   8914 138918  42490  58666   7000  24792  19400  38710  57775
## [461]  81350  21990  67655  53000  40400  12502  76533  82965
## 
## $interrupt_var
##   [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
##  [38] 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
##  [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## [112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## [149] 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [186] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [223] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [260] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [297] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [334] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [371] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [408] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [445] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## Levels: 0 1 2
## 
## $residuals
##            2            3            4            5            6            7 
## -17617.53362 -16095.54964  -8918.26518  17592.88424 -18334.49910  26842.27259 
##            8            9           10           11           12           13 
##   5635.04607  15641.01464 -19594.83743  10021.89835  -4466.70861 -11817.43570 
##           14           15           16           17           18           19 
## -11572.40824   4913.04599  -5575.23880 -12590.71883 -16412.59669  -3103.90252 
##           20           21           22           23           24           25 
##  -6506.34147   1828.96214  -9043.20764   3205.17953 -17912.14264  40522.90814 
##           26           27           28           29           30           31 
## -12507.18870 -10407.49178  17125.49204 -14994.81235   8630.53582  -3310.24578 
##           32           33           34           35           36           37 
##  -8667.86307   3093.61758  51891.63833  15304.29117 -17632.60861 -10270.17629 
##           38           39           40           41           42           43 
##   8618.36413  21718.57333   4766.04860  55037.75689 -13098.61240   2948.23501 
##           44           45           46           47           48           49 
##   6378.12726 -23950.60461 -11023.17616 -11582.26224 -20114.57238  49894.79490 
##           50           51           52           53           54           55 
##  20281.84984  14396.32162  30527.08421 -17065.27819  25923.97771  12473.22086 
##           56           57           58           59           60           61 
##  -9852.33039 -21114.87821 -23905.33968 -22957.91128  35334.91362  -3308.45077 
##           62           63           64           65           66           67 
## -16198.63724  26551.26589 -12306.13780 -21892.27619 -19744.43747   2127.94033 
##           68           69           70           71           72           73 
## 130843.44511  -6256.07046 -12080.92363  22789.82665  16272.14207  64309.51765 
##           74           75           76           77           78           79 
## -16895.94971  13173.07995 -21943.06374  12828.67827 -23763.35948 -18509.35482 
##           80           81           82           83           84           85 
##  -8860.61362  11466.35654 -20407.58518  -4040.12793 -28682.04100  -6126.30866 
##           86           87           88           89           90           91 
## -25294.49685 -16426.28195  -3724.39742  -9606.01949  24499.62765   5666.84751 
##           92           93           94           95           96           97 
##    518.70508 -25382.86903 -11491.55306  29150.93349 -20178.75199  32848.31545 
##           98           99          100          101          102          103 
## -10134.28769  -5329.42043 -22199.75728  -8340.80192 -22432.51288   5852.28608 
##          104          105          106          107          108          109 
## -23878.03449 -17269.90327 -20696.18551 -19226.97524  -3000.12793  13210.14923 
##          110          111          112          113          114          115 
##  -2794.69662   4523.96063 -19975.76650  -7203.99913   3336.73345 -23886.19594 
##          116          117          118          119          120          121 
## -14559.99482    448.40003  25648.72394  66312.31419 -24850.07644  18587.19808 
##          122          123          124          125          126          127 
##   -395.49497    239.52688 -18644.40041 -15177.86232  38504.06927  -7094.24095 
##          128          129          130          131          132          133 
##   4197.42405   9573.59350  60793.31259 -23723.38033 -22593.70369  13644.46296 
##          134          135          136          137          138          139 
##   8092.48293  46932.52137   3516.07080  -9545.63280 -11025.24177   2597.83288 
##          140          141          142          143          144          145 
## -16046.78475  -3784.85891  40070.34407 -23806.37035   2791.38030 -13283.29550 
##          146          147          148          149          150          151 
## -15875.05479    849.24704 -15394.61855 -10796.01784   2341.46932 -15506.47773 
##          152          153          154          155          156          157 
##  11205.83630 -12415.35265  13435.93660 -14398.93360   2405.93942  12282.57658 
##          158          159          160          161          162          163 
##   8411.58844 -25975.49436 -17001.71911 -26190.52790  13292.09116  48236.68674 
##          164          165          166          167          168          169 
## -23813.47329 -32468.15473  -5231.02739 -27428.41028    771.12707 -24035.03279 
##          170          171          172          173          174          175 
##  11953.55636  21026.64059  96582.36071   7745.81154 -40780.84865 -24202.86667 
##          176          177          178          179          180          181 
## -35937.29317  34075.88892  12419.32493  35102.66106  32616.27536 -11613.39284 
##          182          183          184          185          186          187 
## -25003.16944  21176.16372 -44106.88517 -10848.80004 -37601.82235 -32502.10247 
##          188          189          190          191          192          193 
##  18963.36762  54934.80351  13873.81888   3751.58864  33452.04051  47129.55018 
##          194          195          196          197          198          199 
##   6688.59675 -33100.63526  58321.66737  70472.46779 -32953.13470  -1164.42167 
##          200          201          202          203          204          205 
## -37756.15832 -38014.91891 -19948.49511  22606.74155   9003.81849  20810.24840 
##          206          207          208          209          210          211 
## -17240.07778 -40140.76417 -34076.45148  34353.15409  91857.50938   3446.21309 
##          212          213          214          215          216          217 
##  34739.15165  -4474.54776 -10244.12953  40675.10345 -31845.63205   -478.05856 
##          218          219          220          221          222          223 
## -36313.02551 -35837.28885 -26229.60432  15592.14592 -40200.96737 107071.68445 
##          224          225          226          227          228          229 
##  53239.22390 -31218.71444 146320.96963  27196.38098  29460.70466  20045.45344 
##          230          231          232          233          234          235 
##  32349.17670   7784.40075 -32820.33997 119598.76071  21453.30920  67662.97756 
##          236          237          238          239          240          241 
##  29597.46970 -12637.26210 -28953.54189  13877.22234  10959.74550 -38468.93843 
##          242          243          244          245          246          247 
##   5482.89753 -35274.59771  23396.44850 -12924.72462 -39229.91079 -37778.31555 
##          248          249          250          251          252          253 
##  45766.32445 -43612.58116  -2061.60714 -39740.09629 -21041.04444  -9562.90380 
##          254          255          256          257          258          259 
## -16215.16944 -28540.32880   6640.96963  26669.52337    778.47748   -772.38032 
##          260          261          262          263          264          265 
## -14420.80026  66474.65220 108664.81189     61.70423 -26878.59771  14601.20735 
##          266          267          268          269          270          271 
## -31487.06605  -1731.84532  16033.36416  24540.31620 -28646.79125 -24043.29168 
##          272          273          274          275          276          277 
## -16656.79725  40195.11786 -34160.65624  50347.08613   8240.29418   4493.88662 
##          278          279          280          281          282          283 
## -22856.19157  31474.96740  19485.12624  44038.53581  -1151.83209  11693.11842 
##          284          285          286          287          288          289 
##  -8796.29976  23642.75592 -20436.04203  -6222.44394 -38678.45064 -10955.21866 
##          290          291          292          293          294          295 
## 150243.17810  30496.61766  25312.73270 -41248.32457 -12783.13867  -6352.58255 
##          296          297          298          299          300          301 
##  19212.22260  -3171.95017 -43280.30552 -19793.80004  43202.37799  10187.03971 
##          302          303          304          305          306          307 
## -14396.99052 213357.34697  37420.18247 -39662.32000  16971.69780  27423.67708 
##          308          309          310          311          312          313 
## -29111.16802  14830.79631  11209.38995  14772.66388 -41139.10790 -32695.01388 
##          314          315          316          317          318          319 
##   6871.72895    575.77830 -45898.93366   3139.08882 -28434.05535  -9228.76965 
##          320          321          322          323          324          325 
## -40357.53210  37812.22132 -16691.40961 161317.24473 -21672.02088 -14795.14079 
##          326          327          328          329          330          331 
##  54388.24473 -23557.55892 241304.73977 -37114.77543 -31886.13320 -24263.82454 
##          332          333          334          335          336          337 
## -27607.92783  -9625.20725 -44272.91717   1335.09861   1188.93041 -29438.40317 
##          338          339          340          341          342          343 
##  -5801.86877 -33565.77740  36778.82274 -37333.97957 -37060.24982  -3721.57776 
##          344          345          346          347          348          349 
## -28194.54502 -43348.76965  15868.91906  40347.17538 -35456.24565 -30117.54215 
##          350          351          352          353          354          355 
##  10334.27903 -14114.82921 -45869.56059 -40594.73341 -33179.42758  10119.57908 
##          356          357          358          359          360          361 
## -40801.57739   7381.09608 -33095.40125  -7682.16970 -11873.81182   1494.85223 
##          362          363          364          365          366          367 
##  -5692.78602 -30174.98574  24149.94144  25541.61015  -5424.59924 -10418.21248 
##          368          369          370          371          372          373 
##  21174.10167 -26576.37174 -33892.83984 -34624.24003   5221.26049 -35242.94465 
##          374          375          376          377          378          379 
## -27104.46039  -9768.76965  32972.09989 -17690.00361  27898.50827 -45383.00998 
##          380          381          382          383          384          385 
## -37916.71739 -38664.40533 -13086.64631 -40071.78495  21816.49510 -29120.04811 
##          386          387          388          389          390          391 
##  22505.23035  42490.76106 -13103.71708 -27961.36056 -23608.76965  71080.26062 
##          392          393          394          395          396          397 
##  45077.84616 -34658.15455    140.50266 -13666.14853  31252.67639 -21564.65474 
##          398          399          400          401          402          403 
## 140392.78547 -44747.59171 -18928.31555  -3840.97755 -17673.99524  19278.04292 
##          404          405          406          407          408          409 
## -31047.84377  34645.57789  27910.02236 -29439.57698 -11833.76965  33923.17409 
##          410          411          412          413          414          415 
## -42346.85106 -34395.23646  21437.26049  -6242.48615 -37550.22094 -27008.11820 
##          416          417          418          419          420          421 
## -12838.76965  22461.71141 -13238.83502 -22108.27702 -44050.35891  83053.73328 
##          422          423          424          425          426          427 
##   -530.71744  17528.11604 -39031.01560 -40507.85065 -31647.13362 -14924.62659 
##          428          429          430          431          432          433 
## -10794.12506    673.18611 -28399.99243   7435.59391  24596.63911  21156.75186 
##          434          435          436          437          438          439 
## -42852.54329 -33341.78936 -23112.82216 -28400.19182 -20756.83152  -5322.22566 
##          440          441          442          443          444          445 
##    116.77417 -29416.72265 -18980.95988 -39641.61133  11176.13333  27553.48404 
##          446          447          448          449          450          451 
## -33155.11415  -1293.07280  -5239.06899 -36796.83765  -7055.74841 -28075.15341 
##          452          453          454          455          456          457 
## -42924.76965 -39858.49569  90054.61545 -11099.75070   8581.94170 -43672.14558 
##          458          459          460          461          462          463 
## -24001.80004 -30040.63788 -10534.60879   7828.36566  30710.24721 -29506.83474 
##          464          465          466          467          468          469 
##  18316.23035   2001.05444 -10066.15507 -37506.07521  27539.17176  31643.28992 
## 
## $fitted.values
##        2        3        4        5        6        7        8        9 
## 20417.53 20345.55 20398.27 20661.12 21634.50 20363.73 21959.95 21246.99 
##       10       11       12       13       14       15       16       17 
## 21584.84 20316.10 21346.71 20857.44 20572.41 20570.95 21170.24 20810.72 
##       18       19       20       21       22       23       24       25 
## 20542.60 20393.90 20872.34 20766.04 21065.21 20680.82 21112.14 20360.09 
##       26       27       28       29       30       31       32       33 
## 22457.19 20605.49 20614.51 21615.81 20484.46 21302.25 20897.86 20688.38 
##       34       35       36       37       38       39       40       41 
## 21108.36 22897.71 21632.61 20389.18 20611.64 21306.43 21807.95 29254.24 
##       42       43       44       45       46       47       48       49 
## 31352.61 28951.76 29447.87 29590.60 28493.18 28923.26 28918.57 28608.21 
##       50       51       52       53       54       55       56       57 
## 31142.15 30157.68 29907.92 30485.28 28776.02 30276.78 29842.33 29014.88 
##       58       59       60       61       62       63       64       65 
## 28575.34 28457.91 28488.09 30608.45 29280.64 28763.73 30299.14 28942.28 
##       66       67       68       69       70       71       72       73 
## 28544.44 28608.06 29405.55 34114.07 29300.92 28914.17 30167.86 29976.48 
##       74       75       76       77       78       79       80       81 
## 31715.95 28826.92 29815.06 28574.32 29793.36 28507.35 28651.61 29007.64 
##       82       83       84       85       86       87       88       89 
## 29759.59 28628.13 29182.04 28306.31 29094.50 28426.28 28724.40 29197.02 
##       90       91       92       93       94       95       96       97 
## 29000.37 30233.15 29593.29 29382.87 28433.55 28904.07 30398.75 28659.68 
##       98       99      100      101      102      103      104      105 
## 30524.29 29029.42 29149.76 28540.80 29022.51 28527.71 29538.03 28493.90 
##      106      107      108      109      110      111      112      113 
## 28696.19 28578.98 28628.13 29219.85 29830.70 29271.04 29516.77 28635.00 
##      114      115      116      117      118      119      120      121 
## 29067.27 29466.20 28490.99 28794.60 29351.28 30287.69 31800.08 28540.80 
##      122      123      124      125      126      127      128      129 
## 30001.49 29364.47 29364.40 28677.86 28778.93 30734.24 29147.58 29500.41 
##      130      131      132      133      134      135      136      137 
## 29708.69 31578.38 28573.70 28505.54 29820.52 29666.48 31072.93 29545.63 
##      138      139      140      141      142      143      144      145 
## 29015.24 28942.17 29434.78 28774.86 29196.66 30806.37 28542.62 29427.30 
##      146      147      148      149      150      151      152      153 
## 28875.05 28760.75 29364.62 28796.02 28942.53 29425.48 28794.16 29742.35 
##      154      155      156      157      158      159      160      161 
## 28918.06 29827.93 28849.06 29424.42 29804.41 29677.49 28422.72 48954.53 
##      162      163      164      165      166      167      168      169 
## 49366.91 50817.31 52140.47 49569.15 49161.03 50136.41 49364.87 50362.03 
##      170      171      172      173      174      175      176      177 
## 49496.44 50773.36 51149.64 53910.19 50780.85 48902.87 49437.29 49030.11 
##      178      179      180      181      182      183      184      185 
## 51560.68 50865.34 51664.72 51603.39 49993.17 49447.84 51106.89 48793.80 
##      186      187      188      189      190      191      192      193 
## 49918.82 48987.10 49138.63 51015.20 52391.18 50948.41 50527.96 51592.45 
##      194      195      196      197      198      199      200      201 
## 52128.40 50677.64 49178.33 52447.53 53008.13 49268.42 50288.16 48994.92 
##      202      203      204      205      206      207      208      209 
## 48938.50 49593.26 51164.18 50726.75 51140.08 49771.76 48889.45 49077.85 
##      210      211      212      213      214      215      216      217 
## 51572.49 53753.79 50618.85 51642.55 50254.13 49993.90 51835.63 49266.06 
##      218      219      220      221      222      223      224      225 
## 50313.03 49048.29 49019.60 49367.85 50900.97 48928.32 54210.78 52445.71 
##      226      227      228      229      230      231      232      233 
## 49311.03 55651.62 51551.30 51484.55 51139.82 51574.60 50697.34 49189.24 
##      234      235      236      237      238      239      240      241 
## 54675.69 51307.02 52864.53 51537.26 49953.54 49302.78 50836.25 50785.94 
##      242      243      244      245      246      247      248      249 
## 48987.10 50519.60 49093.55 51174.72 49929.91 48928.32 48944.68 51982.58 
##      250      251      252      253      254      255      256      257 
## 48843.61 50240.10 48921.04 49552.90 49993.17 49767.33 49311.03 50573.48 
##      258      259      260      261      262      263      264      265 
## 51347.52 50434.38 50344.80 49845.35 52768.19 54408.30 50519.60 49398.79 
##      266      267      268      269      270      271      272      273 
## 50866.07 49243.85 50266.64 50949.68 51283.79 49362.29 49459.80 49731.88 
##      274      275      276      277      278      279      280      281 
## 51808.66 49180.91 52157.71 50735.11 50547.19 49546.03 51484.87 51119.46 
##      282      283      284      285      286      287      288      289 
## 51998.83 50387.88 50796.30 50066.24 51219.04 49658.44 50118.45 48955.22 
##      290      291      292      293      294      295      296      297 
## 49920.82 55816.38 51677.27 51338.32 48906.14 49852.58 50120.78 51059.95 
##      298      299      300      301      302      303      304      305 
## 50280.31 48793.80 49593.62 51912.96 50796.99 49862.65 58108.82 52012.32 
##      306      307      308      309      310      311      312      313 
## 48988.30 50937.32 51388.17 49349.20 50872.61 50796.34 50923.11 48895.01 
##      314      315      316      317      318      319      320      321 
## 49128.27 50575.22 50398.93 48702.91 50424.06 49338.77 49997.53 48889.78 
##      322      323      324      325      326      327      328      329 
## 51691.41 49811.76 56215.02 49795.14 49811.76 52327.56 49585.26 59114.78 
##      330      331      332      333      334      335      336      337 
## 49339.13 49173.82 49444.93 49333.21 49982.92 48746.90 50360.07 50413.40 
##      338      339      340      341      342      343      344      345 
## 49301.87 50120.78 49141.18 51662.98 49060.25 48975.58 50184.55 49338.77 
##      346      347      348      349      350      351      352      353 
## 48757.08 50888.82 51856.25 49135.54 49230.72 50704.83 49869.56 48684.73 
##      354      355      356      357      358      359      360      361 
## 48833.43 49108.42 50692.58 48898.90 50585.40 49175.17 50047.81 49927.15 
##      362      363      364      365      366      367      368      369 
## 50408.79 50164.99 49266.06 51208.39 51329.60 50208.21 49985.90 51126.37 
##      370      371      372      373      374      375      376      377 
## 49431.84 49104.24 49065.74 50512.94 49094.46 49338.77 49977.90 51555.00 
##      378      379      380      381      382      383      384      385 
## 49770.49 51363.01 48756.72 48933.41 48912.65 49841.78 48894.50 51110.05 
##      386      387      388      389      390      391      392      393 
## 49338.77 51151.24 51943.72 49951.36 49338.77 49474.74 52922.15 52102.15 
##      394      395      396      397      398      399      400      401 
## 49173.50 50332.15 49872.32 51488.65 49627.21 55447.59 48928.32 49629.98 
##      402      403      404      405      406      407      408      409 
## 50204.00 49721.96 51047.84 49266.42 51589.98 51429.58 49338.77 49902.83 
##      410      411      412      413      414      415      416      417 
## 51586.85 48875.24 49065.74 51102.49 50170.22 48998.12 49338.77 49866.29 
##      418      419      420      421      422      423      424      425 
## 51168.84 49918.28 49550.36 48739.27 53330.72 50458.88 51011.02 48974.85 
##      426      427      428      429      430      431      432      433 
## 48847.13 49164.63 49784.13 49956.81 50379.99 49338.41 50603.36 51273.25 
##      434      435      436      437      438      439      440      441 
## 51172.54 48841.79 49102.82 49484.19 49305.83 49577.23 50148.23 50366.72 
##      442      443      444      445      446      447      448      449 
## 49300.96 49641.61 48902.87 50723.52 51385.11 49202.07 50281.07 50176.84 
##      450      451      452      453      454      455      456      457 
## 49025.75 50065.15 49338.77 48772.50 48863.38 53589.75 50084.06 50672.15 
##      458      459      460      461      462      463      464      465 
## 48793.80 49440.64 49244.61 49946.63 50639.75 51496.83 49338.77 50998.95 
##      466      467      468      469 
## 50466.16 50008.08 48993.83 51321.71 
## 
## $shapiro.test
## [1] 0
## 
## $levenes.test
## [1] 0
## 
## $autcorr
## [1] "No autocorrelation evidence"
## 
## $post_sums
## [1] "Post-Est Warning"
## 
## $adjr_sq
## [1] 0.0853
## 
## $fstat.bootstrap
## 
## ORDINARY NONPARAMETRIC BOOTSTRAP
## 
## 
## Call:
## boot::boot(data = x, statistic = f.stat, R = Reps, formula = depvar ~ 
##     ., parallel = parr)
## 
## 
## Bootstrap Statistics :
##       original    bias    std. error
## t1* 19.4333579 0.5793671    4.757213
## t2*  0.6144496 1.0240832    2.266514
## WARNING: All values of t3* are NA
## 
## $itsa.plot
## 
## $booted.ints
##       Parameter     Lower CI Median F-value  Upper CI
## 1 interrupt_var 12.791471632     19.7256159 28.341956
## 2    lag_depvar  0.006510307      0.7545766  6.307942
itsa_metro_region_quar2<-
        its.analysis::itsa.model(time = "day", depvar = "trend",data=tsdata_gastos_trend,
                                 interrupt_var = "covid", 
                                 alpha = 0.05,no.plots = F, bootstrap = TRUE, Reps = 10000, print = F) 

print(itsa_metro_region_quar2)
## [[1]]
## [1] "ITSA Model Fit"
## 
## $aov.result
## Anova Table (Type II tests)
## 
## Response: depvar
##                   Sum Sq  Df   F value Pr(>F)    
## interrupt_var 4.1737e+08   2    4.5777 0.0108 *  
## lag_depvar    7.3919e+10   1 1621.5153 <2e-16 ***
## Residuals     2.0879e+10 458                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## $tukey.result
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: stats::aov(formula = x$depvar ~ x$interrupt_var)
## 
## $`x$interrupt_var`
##          diff        lwr      upr     p adj
## 1-0  7228.838   807.4497 13650.23 0.0228181
## 2-0 27949.925 21995.9148 33903.94 0.0000000
## 2-1 20721.087 17081.4175 24360.76 0.0000000
## 
## 
## $data
##        depvar interrupt_var lag_depvar
## 2    19269.29             0   16010.00
## 3    24139.00             0   19269.29
## 4    23816.14             0   24139.00
## 5    26510.14             0   23816.14
## 6    23456.71             0   26510.14
## 7    24276.71             0   23456.71
## 8    18818.71             0   24276.71
## 9    18517.14             0   18818.71
## 10   15475.29             0   18517.14
## 11   16365.29             0   15475.29
## 12   12621.29             0   16365.29
## 13   12679.86             0   12621.29
## 14   13440.71             0   12679.86
## 15   15382.86             0   13440.71
## 16   13459.71             0   15382.86
## 17   14644.14             0   13459.71
## 18   13927.00             0   14644.14
## 19   22034.57             0   13927.00
## 20   20986.00             0   22034.57
## 21   20390.57             0   20986.00
## 22   22554.14             0   20390.57
## 23   21782.57             0   22554.14
## 24   22529.57             0   21782.57
## 25   24642.71             0   22529.57
## 26   17692.29             0   24642.71
## 27   19668.29             0   17692.29
## 28   28640.00             0   19668.29
## 29   28706.00             0   28640.00
## 30   28331.57             0   28706.00
## 31   25617.86             0   28331.57
## 32   27223.29             0   25617.86
## 33   31622.57             0   27223.29
## 34   32021.43             0   31622.57
## 35   33634.57             0   32021.43
## 36   30784.86             0   33634.57
## 37   34770.57             0   30784.86
## 38   38443.00             1   34770.57
## 39   35073.00             1   38443.00
## 40   31422.29             1   35073.00
## 41   30103.29             1   31422.29
## 42   19319.29             1   30103.29
## 43   27926.29             1   19319.29
## 44   30715.43             1   27926.29
## 45   31962.29             1   30715.43
## 46   39790.14             1   31962.29
## 47   39211.57             1   39790.14
## 48   44548.57             1   39211.57
## 49   49398.00             1   44548.57
## 50   41039.00             1   49398.00
## 51   34821.29             1   41039.00
## 52   29123.57             1   34821.29
## 53   21275.71             1   29123.57
## 54   28476.14             1   21275.71
## 55   24561.86             1   28476.14
## 56   20323.57             1   24561.86
## 57   25370.00             1   20323.57
## 58   26811.86             1   25370.00
## 59   27151.86             1   26811.86
## 60   27623.29             1   27151.86
## 61   22896.57             1   27623.29
## 62   41889.29             1   22896.57
## 63   44000.14             1   41889.29
## 64   38558.00             1   44000.14
## 65   43373.86             1   38558.00
## 66   49001.00             1   43373.86
## 67   61213.29             1   49001.00
## 68   58939.57             1   61213.29
## 69   42046.86             1   58939.57
## 70   39191.71             1   42046.86
## 71   42646.43             1   39191.71
## 72   36121.57             1   42646.43
## 73   30915.57             1   36121.57
## 74   20273.43             1   30915.57
## 75   23938.29             1   20273.43
## 76   19274.29             1   23938.29
## 77   21662.29             1   19274.29
## 78   15819.00             1   21662.29
## 79   18126.14             1   15819.00
## 80   17240.71             1   18126.14
## 81   16127.71             1   17240.71
## 82   13917.14             1   16127.71
## 83   15379.86             1   13917.14
## 84   19510.14             1   15379.86
## 85   24567.29             1   19510.14
## 86   25700.43             1   24567.29
## 87   25729.00             1   25700.43
## 88   26435.00             1   25729.00
## 89   31157.14             1   26435.00
## 90   29818.43             1   31157.14
## 91   30962.43             1   29818.43
## 92   28746.71             1   30962.43
## 93   27830.71             1   28746.71
## 94   28252.14             1   27830.71
## 95   28717.57             1   28252.14
## 96   21365.43             1   28717.57
## 97   24816.86             1   21365.43
## 98   16838.57             1   24816.86
## 99   15529.14             1   16838.57
## 100  13286.29             1   15529.14
## 101  13629.43             1   13286.29
## 102  14404.86             1   13629.43
## 103  19524.86             1   14404.86
## 104  18475.71             1   19524.86
## 105  22495.00             1   18475.71
## 106  22254.57             1   22495.00
## 107  24173.29             1   22254.57
## 108  27466.43             1   24173.29
## 109  24602.43             1   27466.43
## 110  20531.14             1   24602.43
## 111  20846.43             1   20531.14
## 112  23875.71             1   20846.43
## 113  36312.71             1   23875.71
## 114  34244.00             1   36312.71
## 115  36347.43             1   34244.00
## 116  39779.71             1   36347.43
## 117  42018.71             1   39779.71
## 118  39372.57             1   42018.71
## 119  33444.00             1   39372.57
## 120  29255.86             1   33444.00
## 121  31640.14             1   29255.86
## 122  29671.14             1   31640.14
## 123  31023.71             1   29671.14
## 124  39723.43             1   31023.71
## 125  39314.14             1   39723.43
## 126  38239.86             1   39314.14
## 127  34649.43             1   38239.86
## 128  36688.43             1   34649.43
## 129  42867.57             1   36688.43
## 130  42226.86             1   42867.57
## 131  32155.14             1   42226.86
## 132  33603.00             1   32155.14
## 133  37254.43             1   33603.00
## 134  33145.57             1   37254.43
## 135  31299.43             1   33145.57
## 136  30252.00             1   31299.43
## 137  26310.71             1   30252.00
## 138  27929.86             1   26310.71
## 139  27666.14             1   27929.86
## 140  25017.57             1   27666.14
## 141  27335.00             1   25017.57
## 142  25760.71             1   27335.00
## 143  18436.86             1   25760.71
## 144  21906.00             1   18436.86
## 145  19418.14             1   21906.00
## 146  22826.14             1   19418.14
## 147  23444.29             1   22826.14
## 148  25264.86             1   23444.29
## 149  25473.29             1   25264.86
## 150  27366.86             1   25473.29
## 151  28855.86             1   27366.86
## 152  32326.86             1   28855.86
## 153  27141.43             1   32326.86
## 154  26297.71             1   27141.43
## 155  23499.14             1   26297.71
## 156  30246.29             1   23499.14
## 157  39931.86             1   30246.29
## 158  38020.43             2   39931.86
## 159  35004.00             2   38020.43
## 160  40750.86             2   35004.00
## 161  42363.29             2   40750.86
## 162  46273.57             2   42363.29
## 163  41083.29             2   46273.57
## 164  35711.29             2   41083.29
## 165  41921.71             2   35711.29
## 166  60583.29             2   41921.71
## 167  63115.57             2   60583.29
## 168  61300.14             2   63115.57
## 169  57666.43             2   61300.14
## 170  55834.00             2   57666.43
## 171  58927.71             2   55834.00
## 172  57810.57             2   58927.71
## 173  48987.14             2   57810.57
## 174  52219.29             2   48987.14
## 175  56503.57             2   52219.29
## 176  56545.00             2   56503.57
## 177  64705.57             2   56545.00
## 178  53833.29             2   64705.57
## 179  50114.00             2   53833.29
## 180  39592.43             2   50114.00
## 181  29907.29             2   39592.43
## 182  33923.29             2   29907.29
## 183  45489.00             2   33923.29
## 184  44866.29             2   45489.00
## 185  51680.57             2   44866.29
## 186  58257.00             2   51680.57
## 187  70600.57             2   58257.00
## 188  76648.00             2   70600.57
## 189  69430.14             2   76648.00
## 190  69651.57             2   69430.14
## 191  77745.14             2   69651.57
## 192  72795.86             2   77745.14
## 193  67670.71             2   72795.86
## 194  55357.86             2   67670.71
## 195  48524.00             2   55357.86
## 196  50154.43             2   48524.00
## 197  45111.57             2   50154.43
## 198  36147.00             2   45111.57
## 199  43501.57             2   36147.00
## 200  41472.43             2   43501.57
## 201  41058.00             2   41472.43
## 202  41605.57             2   41058.00
## 203  49382.86             2   41605.57
## 204  59558.57             2   49382.86
## 205  59134.57             2   59558.57
## 206  61109.00             2   59134.57
## 207  63004.43             2   61109.00
## 208  67344.29             2   63004.43
## 209  78180.86             2   67344.29
## 210  69117.86             2   78180.86
## 211  55597.57             2   69117.86
## 212  49426.14             2   55597.57
## 213  39119.43             2   49426.14
## 214  35636.86             2   39119.43
## 215  39201.14             2   35636.86
## 216  27777.00             2   39201.14
## 217  47207.00             2   27777.00
## 218  55587.29             2   47207.00
## 219  56619.71             2   55587.29
## 220  82679.86             2   56619.71
## 221  91259.57             2   82679.86
## 222  93552.71             2   91259.57
## 223 102242.71             2   93552.71
## 224  91884.00             2  102242.71
## 225  85013.86             2   91884.00
## 226  84535.29             2   85013.86
## 227  80700.43             2   84535.29
## 228  79740.57             2   80700.43
## 229  85163.14             2   79740.57
## 230  86724.86             2   85163.14
## 231  80355.00             2   86724.86
## 232  74875.14             2   80355.00
## 233  81347.00             2   74875.14
## 234  66062.43             2   81347.00
## 235  56946.43             2   66062.43
## 236  47732.14             2   56946.43
## 237  38129.71             2   47732.14
## 238  42928.29             2   38129.71
## 239  45392.57             2   42928.29
## 240  37895.43             2   45392.57
## 241  30660.29             2   37895.43
## 242  42430.86             2   30660.29
## 243  35845.14             2   42430.86
## 244  40350.43             2   35845.14
## 245  31494.71             2   40350.43
## 246  30013.29             2   31494.71
## 247  34197.57             2   30013.29
## 248  37430.14             2   34197.57
## 249  26932.43             2   37430.14
## 250  33729.86             2   26932.43
## 251  38081.43             2   33729.86
## 252  44028.00             2   38081.43
## 253  47139.71             2   44028.00
## 254  46558.86             2   47139.71
## 255  58350.57             2   46558.86
## 256  78380.00             2   58350.57
## 257  78168.29             2   78380.00
## 258  70510.86             2   78168.29
## 259  72207.14             2   70510.86
## 260  67881.00             2   72207.14
## 261  69536.43             2   67881.00
## 262  62390.71             2   69536.43
## 263  50113.14             2   62390.71
## 264  45565.57             2   50113.14
## 265  45805.29             2   45565.57
## 266  41348.57             2   45805.29
## 267  51426.86             2   41348.57
## 268  47160.57             2   51426.86
## 269  51907.43             2   47160.57
## 270  49751.43             2   51907.43
## 271  54407.43             2   49751.43
## 272  54746.29             2   54407.43
## 273  61634.57             2   54746.29
## 274  58926.43             2   61634.57
## 275  69999.29             2   58926.43
## 276  63044.86             2   69999.29
## 277  63285.29             2   63044.86
## 278  61395.43             2   63285.29
## 279  67969.43             2   61395.43
## 280  60792.57             2   67969.43
## 281  56859.14             2   60792.57
## 282  44899.43             2   56859.14
## 283  43064.14             2   44899.43
## 284  62790.29             2   43064.14
## 285  69120.71             2   62790.29
## 286  69589.43             2   69120.71
## 287  66633.29             2   69589.43
## 288  65588.57             2   66633.29
## 289  70168.57             2   65588.57
## 290  74644.71             2   70168.57
## 291  52891.00             2   74644.71
## 292  41560.57             2   52891.00
## 293  34704.86             2   41560.57
## 294  46520.00             2   34704.86
## 295  50231.00             2   46520.00
## 296  49216.71             2   50231.00
## 297  76914.86             2   49216.71
## 298  83720.71             2   76914.86
## 299  84485.00             2   83720.71
## 300  89765.00             2   84485.00
## 301  87702.86             2   89765.00
## 302  82013.86             2   87702.86
## 303  85982.43             2   82013.86
## 304  57248.43             2   85982.43
## 305  52968.43             2   57248.43
## 306  52601.86             2   52968.43
## 307  45493.29             2   52601.86
## 308  42298.86             2   45493.29
## 309  46423.71             2   42298.86
## 310  37898.00             2   46423.71
## 311  36435.14             2   37898.00
## 312  30209.57             2   36435.14
## 313  34541.86             2   30209.57
## 314  33604.71             2   34541.86
## 315  37990.71             2   33604.71
## 316  35683.43             2   37990.71
## 317  65201.86             2   35683.43
## 318  62730.57             2   65201.86
## 319  64589.14             2   62730.57
## 320  73744.86             2   64589.14
## 321  76477.71             2   73744.86
## 322 105647.43             2   76477.71
## 323 103790.29             2  105647.43
## 324  76122.29             2  103790.29
## 325  74746.14             2   76122.29
## 326  72865.71             2   74746.14
## 327  63652.57             2   72865.71
## 328  60358.29             2   63652.57
## 329  25957.14             2   60358.29
## 330  30178.43             2   25957.14
## 331  30681.57             2   30178.43
## 332  33337.29             2   30681.57
## 333  32582.71             2   33337.29
## 334  39184.43             2   32582.71
## 335  40415.71             2   39184.43
## 336  34975.43             2   40415.71
## 337  34076.14             2   34975.43
## 338  34221.14             2   34076.14
## 339  28862.57             2   34221.14
## 340  35729.86             2   28862.57
## 341  36489.29             2   35729.86
## 342  36785.14             2   36489.29
## 343  37787.71             2   36785.14
## 344  39832.14             2   37787.71
## 345  41917.86             2   39832.14
## 346  41633.57             2   41917.86
## 347  33557.00             2   41633.57
## 348  22759.57             2   33557.00
## 349  28877.86             2   22759.57
## 350  27574.00             2   28877.86
## 351  27104.71             2   27574.00
## 352  24376.14             2   27104.71
## 353  29732.29             2   24376.14
## 354  34030.00             2   29732.29
## 355  39139.71             2   34030.00
## 356  37066.57             2   39139.71
## 357  38509.29             2   37066.57
## 358  40957.29             2   38509.29
## 359  49423.00             2   40957.29
## 360  50053.29             2   49423.00
## 361  50284.14             2   50053.29
## 362  53103.86             2   50284.14
## 363  50223.00             2   53103.86
## 364  49587.14             2   50223.00
## 365  41167.71             2   49587.14
## 366  37958.71             2   41167.71
## 367  33582.29             2   37958.71
## 368  31039.43             2   33582.29
## 369  26526.57             2   31039.43
## 370  34869.43             2   26526.57
## 371  37487.43             2   34869.43
## 372  46514.43             2   37487.43
## 373  39613.43             2   46514.43
## 374  38980.57             2   39613.43
## 375  37306.14             2   38980.57
## 376  36771.29             2   37306.14
## 377  26317.00             2   36771.29
## 378  31580.71             2   26317.00
## 379  23626.57             2   31580.71
## 380  33035.71             2   23626.57
## 381  44864.57             2   33035.71
## 382  48946.14             2   44864.57
## 383  46969.57             2   48946.14
## 384  49249.57             2   46969.57
## 385  56370.14             2   49249.57
## 386  67228.71             2   56370.14
## 387  59457.29             2   67228.71
## 388  53124.71             2   59457.29
## 389  52814.14             2   53124.71
## 390  61262.00             2   52814.14
## 391  61861.14             2   61262.00
## 392  71784.71             2   61861.14
## 393  59313.29             2   71784.71
## 394  61107.00             2   59313.29
## 395  60603.43             2   61107.00
## 396  60012.57             2   60603.43
## 397  58280.43             2   60012.57
## 398  56862.71             2   58280.43
## 399  41704.43             2   56862.71
## 400  51533.00             2   41704.43
## 401  50388.71             2   51533.00
## 402  49205.29             2   50388.71
## 403  56533.29             2   49205.29
## 404  47996.14             2   56533.29
## 405  47207.57             2   47996.14
## 406  45292.00             2   47207.57
## 407  40343.43             2   45292.00
## 408  39004.86             2   40343.43
## 409  36788.43             2   39004.86
## 410  30027.57             2   36788.43
## 411  39040.14             2   30027.57
## 412  42390.14             2   39040.14
## 413  36291.14             2   42390.14
## 414  30668.29             2   36291.14
## 415  47693.00             2   30668.29
## 416  52094.43             2   47693.00
## 417  56592.57             2   52094.43
## 418  47971.43             2   56592.57
## 419  43762.43             2   47971.43
## 420  42246.71             2   43762.43
## 421  46352.43             2   42246.71
## 422  33094.86             2   46352.43
## 423  32784.86             2   33094.86
## 424  26212.43             2   32784.86
## 425  32611.57             2   26212.43
## 426  42144.86             2   32611.57
## 427  50034.86             2   42144.86
## 428  46332.00             2   50034.86
## 429  42976.29             2   46332.00
## 430  39456.29             2   42976.29
## 431  39328.29             2   39456.29
## 432  35296.14             2   39328.29
## 433  30875.43             2   35296.14
## 434  27709.00             2   30875.43
## 435  29513.29             2   27709.00
## 436  31630.43             2   29513.29
## 437  29346.14             2   31630.43
## 438  34916.86             2   29346.14
## 439  42020.86             2   34916.86
## 440  38303.00             2   42020.86
## 441  37966.43             2   38303.00
## 442  41408.14             2   37966.43
## 443  38988.14             2   41408.14
## 444  43555.29             2   38988.14
## 445  38114.00             2   43555.29
## 446  27847.86             2   38114.00
## 447  26517.00             2   27847.86
## 448  39518.29             2   26517.00
## 449  39153.71             2   39518.29
## 450  45623.14             2   39153.71
## 451  40627.43             2   45623.14
## 452  41027.71             2   40627.43
## 453  42882.86             2   41027.71
## 454  47139.43             2   42882.86
## 455  35547.57             2   47139.43
## 456  41099.00             2   35547.57
## 457  35859.57             2   41099.00
## 458  44524.57             2   35859.57
## 459  48554.29             2   44524.57
## 460  51554.29             2   48554.29
## 461  47810.29             2   51554.29
## 462  50490.00             2   47810.29
## 463  50720.71             2   50490.00
## 
## $alpha
## [1] 0.05
## 
## $itsa.result
## [1] "Significant variation between time periods with chosen alpha"
## 
## $group.means
##   interrupt_var count     mean      s.d.
## 1             0    37 22066.04  6308.636
## 2             1   120 29463.10  9187.258
## 3             2   306 50184.19 16531.992
## 
## $dependent
##   [1]  19269.29  24139.00  23816.14  26510.14  23456.71  24276.71  18818.71
##   [8]  18517.14  15475.29  16365.29  12621.29  12679.86  13440.71  15382.86
##  [15]  13459.71  14644.14  13927.00  22034.57  20986.00  20390.57  22554.14
##  [22]  21782.57  22529.57  24642.71  17692.29  19668.29  28640.00  28706.00
##  [29]  28331.57  25617.86  27223.29  31622.57  32021.43  33634.57  30784.86
##  [36]  34770.57  38443.00  35073.00  31422.29  30103.29  19319.29  27926.29
##  [43]  30715.43  31962.29  39790.14  39211.57  44548.57  49398.00  41039.00
##  [50]  34821.29  29123.57  21275.71  28476.14  24561.86  20323.57  25370.00
##  [57]  26811.86  27151.86  27623.29  22896.57  41889.29  44000.14  38558.00
##  [64]  43373.86  49001.00  61213.29  58939.57  42046.86  39191.71  42646.43
##  [71]  36121.57  30915.57  20273.43  23938.29  19274.29  21662.29  15819.00
##  [78]  18126.14  17240.71  16127.71  13917.14  15379.86  19510.14  24567.29
##  [85]  25700.43  25729.00  26435.00  31157.14  29818.43  30962.43  28746.71
##  [92]  27830.71  28252.14  28717.57  21365.43  24816.86  16838.57  15529.14
##  [99]  13286.29  13629.43  14404.86  19524.86  18475.71  22495.00  22254.57
## [106]  24173.29  27466.43  24602.43  20531.14  20846.43  23875.71  36312.71
## [113]  34244.00  36347.43  39779.71  42018.71  39372.57  33444.00  29255.86
## [120]  31640.14  29671.14  31023.71  39723.43  39314.14  38239.86  34649.43
## [127]  36688.43  42867.57  42226.86  32155.14  33603.00  37254.43  33145.57
## [134]  31299.43  30252.00  26310.71  27929.86  27666.14  25017.57  27335.00
## [141]  25760.71  18436.86  21906.00  19418.14  22826.14  23444.29  25264.86
## [148]  25473.29  27366.86  28855.86  32326.86  27141.43  26297.71  23499.14
## [155]  30246.29  39931.86  38020.43  35004.00  40750.86  42363.29  46273.57
## [162]  41083.29  35711.29  41921.71  60583.29  63115.57  61300.14  57666.43
## [169]  55834.00  58927.71  57810.57  48987.14  52219.29  56503.57  56545.00
## [176]  64705.57  53833.29  50114.00  39592.43  29907.29  33923.29  45489.00
## [183]  44866.29  51680.57  58257.00  70600.57  76648.00  69430.14  69651.57
## [190]  77745.14  72795.86  67670.71  55357.86  48524.00  50154.43  45111.57
## [197]  36147.00  43501.57  41472.43  41058.00  41605.57  49382.86  59558.57
## [204]  59134.57  61109.00  63004.43  67344.29  78180.86  69117.86  55597.57
## [211]  49426.14  39119.43  35636.86  39201.14  27777.00  47207.00  55587.29
## [218]  56619.71  82679.86  91259.57  93552.71 102242.71  91884.00  85013.86
## [225]  84535.29  80700.43  79740.57  85163.14  86724.86  80355.00  74875.14
## [232]  81347.00  66062.43  56946.43  47732.14  38129.71  42928.29  45392.57
## [239]  37895.43  30660.29  42430.86  35845.14  40350.43  31494.71  30013.29
## [246]  34197.57  37430.14  26932.43  33729.86  38081.43  44028.00  47139.71
## [253]  46558.86  58350.57  78380.00  78168.29  70510.86  72207.14  67881.00
## [260]  69536.43  62390.71  50113.14  45565.57  45805.29  41348.57  51426.86
## [267]  47160.57  51907.43  49751.43  54407.43  54746.29  61634.57  58926.43
## [274]  69999.29  63044.86  63285.29  61395.43  67969.43  60792.57  56859.14
## [281]  44899.43  43064.14  62790.29  69120.71  69589.43  66633.29  65588.57
## [288]  70168.57  74644.71  52891.00  41560.57  34704.86  46520.00  50231.00
## [295]  49216.71  76914.86  83720.71  84485.00  89765.00  87702.86  82013.86
## [302]  85982.43  57248.43  52968.43  52601.86  45493.29  42298.86  46423.71
## [309]  37898.00  36435.14  30209.57  34541.86  33604.71  37990.71  35683.43
## [316]  65201.86  62730.57  64589.14  73744.86  76477.71 105647.43 103790.29
## [323]  76122.29  74746.14  72865.71  63652.57  60358.29  25957.14  30178.43
## [330]  30681.57  33337.29  32582.71  39184.43  40415.71  34975.43  34076.14
## [337]  34221.14  28862.57  35729.86  36489.29  36785.14  37787.71  39832.14
## [344]  41917.86  41633.57  33557.00  22759.57  28877.86  27574.00  27104.71
## [351]  24376.14  29732.29  34030.00  39139.71  37066.57  38509.29  40957.29
## [358]  49423.00  50053.29  50284.14  53103.86  50223.00  49587.14  41167.71
## [365]  37958.71  33582.29  31039.43  26526.57  34869.43  37487.43  46514.43
## [372]  39613.43  38980.57  37306.14  36771.29  26317.00  31580.71  23626.57
## [379]  33035.71  44864.57  48946.14  46969.57  49249.57  56370.14  67228.71
## [386]  59457.29  53124.71  52814.14  61262.00  61861.14  71784.71  59313.29
## [393]  61107.00  60603.43  60012.57  58280.43  56862.71  41704.43  51533.00
## [400]  50388.71  49205.29  56533.29  47996.14  47207.57  45292.00  40343.43
## [407]  39004.86  36788.43  30027.57  39040.14  42390.14  36291.14  30668.29
## [414]  47693.00  52094.43  56592.57  47971.43  43762.43  42246.71  46352.43
## [421]  33094.86  32784.86  26212.43  32611.57  42144.86  50034.86  46332.00
## [428]  42976.29  39456.29  39328.29  35296.14  30875.43  27709.00  29513.29
## [435]  31630.43  29346.14  34916.86  42020.86  38303.00  37966.43  41408.14
## [442]  38988.14  43555.29  38114.00  27847.86  26517.00  39518.29  39153.71
## [449]  45623.14  40627.43  41027.71  42882.86  47139.43  35547.57  41099.00
## [456]  35859.57  44524.57  48554.29  51554.29  47810.29  50490.00  50720.71
## 
## $interrupt_var
##   [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
##  [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
##  [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## [112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## [149] 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [186] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [223] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [260] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [297] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [334] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [371] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [408] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [445] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## Levels: 0 1 2
## 
## $residuals
##             2             3             4             5             6 
##  2.073912e+03  4.063951e+03 -5.614423e+02  2.417811e+03 -3.015845e+03 
##             7             8             9            10            11 
##  5.019487e+02 -5.680546e+03 -1.159813e+03 -3.935223e+03 -3.576527e+02 
##            12            13            14            15            16 
## -4.887994e+03 -1.521488e+03 -8.123806e+02  4.575225e+02 -3.181561e+03 
##            17            18            19            20            21 
## -2.979788e+02 -2.061599e+03  6.679589e+03 -1.532261e+03 -1.201245e+03 
##            22            23            24            25            26 
##  1.488405e+03 -1.194746e+03  2.339603e+02  1.687107e+03 -7.130346e+03 
##            27            28            29            30            31 
##  9.865625e+02  8.212423e+03  3.516488e+02 -8.109276e+01 -2.463988e+03 
##            32            33            34            35            36 
##  1.539087e+03  4.519929e+03  1.031888e+03  2.292628e+03 -1.982345e+03 
##            37            38            39            40            41 
##  4.521176e+03  4.252591e+03 -2.362107e+03 -3.035327e+03 -1.128814e+03 
##            42            43            44            45            46 
## -1.074744e+04  7.387543e+03  2.572148e+03  1.354715e+03  8.080937e+03 
##            47            48            49            50            51 
##  5.862236e+02  6.434409e+03  6.568440e+03 -6.075173e+03 -4.907464e+03 
##            52            53            54            55            56 
## -5.111645e+03 -7.925403e+03  6.208838e+03 -4.067238e+03 -4.847137e+03 
##            57            58            59            60            61 
##  3.943941e+03  9.271303e+02 -6.792929e+00  1.642356e+02 -4.979000e+03 
##            62            63            64            65            66 
##  1.818991e+04  3.520141e+03 -3.787007e+03  5.837144e+03  7.209335e+03 
##            67            68            69            70            71 
##  1.444987e+04  1.386246e+03 -1.349757e+04 -1.427507e+03  4.549810e+03 
##            72            73            74            75            76 
## -5.027389e+03 -4.468485e+03 -1.051097e+04  2.556530e+03 -5.345479e+03 
##            77            78            79            80            81 
##  1.163302e+03 -6.789852e+03  6.800059e+02 -2.243851e+03 -2.574549e+03 
##            82            83            84            85            86 
## -3.801752e+03 -3.859330e+02  2.452002e+03  3.859915e+03  5.249235e+02 
##            87            88            89            90            91 
## -4.476702e+02  2.330861e+02  4.331457e+03 -1.179409e+03  1.147384e+03 
##            92            93            94            95            96 
## -2.079088e+03 -1.037439e+03  1.933025e+02  2.863865e+02 -7.476976e+03 
##            97            98            99           100           101 
##  2.470287e+03 -8.557437e+03 -2.817816e+03 -3.903754e+03 -1.578981e+03 
##           102           103           104           105           106 
## -1.106729e+03  3.328157e+03 -2.244657e+03  2.701578e+03 -1.090008e+03 
##           107           108           109           110           111 
##  1.041132e+03  2.639034e+03 -3.134555e+03 -4.675412e+03 -7.630254e+02 
##           112           113           114           115           116 
##  1.987696e+03  1.174823e+04 -1.308937e+03  2.622261e+03  4.196106e+03 
##           117           118           119           120           121 
##  3.402580e+03 -1.221785e+03 -4.812411e+03 -3.762487e+03  2.322147e+03 
##           122           123           124           125           126 
## -1.753440e+03  1.338801e+03  8.843479e+03  7.477391e+02  3.506937e+01 
##           127           128           129           130           131 
## -2.606196e+03  2.605053e+03  6.982680e+03  8.825106e+02 -8.623114e+03 
##           132           133           134           135           136 
##  1.723400e+03  4.095604e+03 -3.239398e+03 -1.455245e+03 -8.715516e+02 
##           137           138           139           140           141 
## -3.887403e+03  1.213982e+03 -4.802931e+02 -2.895865e+03  1.761654e+03 
##           142           143           144           145           146 
## -1.860148e+03 -7.793077e+03  2.146909e+03 -3.406038e+03  2.200057e+03 
##           147           148           149           150           151 
## -1.928684e+02  1.081556e+03 -3.185443e+02  1.390874e+03  1.206848e+03 
##           152           153           154           155           156 
##  3.362273e+03 -4.889886e+03 -1.152122e+03 -3.205247e+03  6.014516e+03 
##           157           158           159           160           161 
##  9.738788e+03 -3.136674e+03 -4.464299e+03  3.947661e+03  4.825723e+02 
##           162           163           164           165           166 
##  2.968230e+03 -5.676908e+03 -6.463138e+03  4.493611e+03  1.766809e+04 
##           167           168           169           170           171 
##  3.712323e+03 -3.404544e+02 -2.370184e+03 -9.921191e+02  3.720600e+03 
##           172           173           174           175           176 
## -1.299307e+02 -7.966331e+03  3.061571e+03  4.490164e+03  7.462995e+02 
##           177           178           179           180           181 
##  8.870268e+03 -9.212123e+03 -3.325424e+03 -1.056090e+04 -1.094992e+04 
##           182           183           184           185           186 
##  1.623187e+03  9.640647e+03 -1.200717e+03  6.163756e+03  6.719562e+03 
##           187           188           189           190           191 
##  1.325267e+04  8.394185e+03 -4.166754e+03  2.431864e+03  1.032980e+04 
##           192           193           194           195           196 
## -1.770397e+03 -2.522701e+03 -1.030734e+04 -6.262428e+03  1.405914e+03 
##           197           198           199           200           201 
## -5.077474e+03 -9.586533e+03  5.688501e+03 -2.838622e+03 -1.460243e+03 
##           202           203           204           205           206 
## -5.465118e+02  6.746978e+03  1.005123e+04  6.366884e+02  2.985733e+03 
##           207           208           209           210           211 
##  3.136696e+03  5.801886e+03  1.280407e+04 -5.833364e+03 -1.134622e+04 
##           212           213           214           215           216 
## -5.572080e+03 -1.042616e+04 -4.802441e+03  1.838799e+03 -1.273450e+04 
##           217           218           219           220           221 
##  1.678907e+04  8.002380e+03  1.630579e+03  2.677854e+04  1.233335e+04 
##           222           223           224           225           226 
##  7.046064e+03  1.371000e+04 -4.326581e+03 -2.044494e+03  3.546908e+03 
##           227           228           229           230           231 
##  1.348827e+02  2.563235e+03  8.833868e+03  5.604581e+03 -2.145097e+03 
##           232           233           234           235           236 
## -1.996997e+03  9.316475e+03 -1.168617e+04 -7.297804e+03 -8.457835e+03 
##           237           238           239           240           241 
## -9.919171e+03  3.363429e+03  1.588036e+03 -8.086376e+03 -8.697572e+03 
##           242           243           244           245           246 
##  9.465461e+03 -7.519900e+03  2.804058e+03 -1.003221e+04 -3.689353e+03 
##           247           248           249           250           251 
##  1.803819e+03  1.339450e+03 -1.201434e+04  4.058132e+03  2.403975e+03 
##           252           253           254           255           256 
##  4.505805e+03  2.363549e+03 -9.665998e+02  1.133832e+04  2.094942e+04 
##           257           258           259           260           261 
##  3.041116e+03 -4.429257e+03  4.032593e+03 -1.792268e+03  3.685435e+03 
##           262           263           264           265           266 
## -4.922899e+03 -1.088702e+04 -4.586997e+03 -3.293696e+02 -4.997879e+03 
##           267           268           269           270           271 
##  9.018046e+03 -4.152702e+03  4.363544e+03 -1.986444e+03  4.574445e+03 
##           272           273           274           275           276 
##  7.995891e+02  7.388485e+03 -1.405662e+03  1.205992e+04 -4.677704e+03 
##           277           278           279           280           281 
##  1.707167e+03 -3.951163e+02  7.848628e+03 -5.136552e+03 -2.729016e+03 
##           282           283           284           285           286 
## -1.121343e+04 -2.481956e+03  1.886572e+04  7.767516e+03  2.643111e+03 
##           287           288           289           290           291 
## -7.271551e+02  8.399699e+02  6.343006e+03  6.772584e+03 -1.893593e+04 
##           292           293           294           295           296 
## -1.104632e+04 -7.891263e+03  9.981106e+03  3.253079e+03 -1.039985e+03 
##           297           298           299           300           301 
##  2.755431e+04  9.888042e+03  4.639152e+03  9.243883e+03  2.516705e+03 
##           302           303           304           305           306 
## -1.350331e+03  7.644639e+03 -2.459571e+04 -3.488375e+03 -7.344054e+01 
##           307           308           309           310           311 
## -6.858135e+03 -3.771932e+03  3.175297e+03 -8.994850e+03 -2.924987e+03 
##           312           313           314           315           316 
## -7.858081e+03  1.974680e+03 -2.790165e+03  2.423829e+03 -3.758617e+03 
##           317           318           319           320           321 
##  2.779837e+04 -7.533208e+02  3.288704e+03  1.080232e+04  5.445830e+03 
##           322           323           324           325           326 
##  3.220098e+04  4.571540e+03 -2.145562e+04  1.613730e+03  9.491645e+02 
##           327           328           329           330           331 
## -6.602564e+03 -1.756767e+03 -3.324731e+04  1.368397e+03 -1.858090e+03 
##           332           333           334           335           336 
##  3.530828e+02 -2.747890e+03  4.520510e+03 -8.101337e+01 -6.609176e+03 
##           337           338           339           340           341 
## -2.701809e+03 -1.762264e+03 -7.248947e+03  4.352794e+03 -9.552263e+02 
##           342           343           344           345           346 
## -1.330347e+03 -5.891738e+02  5.694534e+02  8.488548e+02 -1.278221e+03 
##           347           348           349           350           351 
## -9.103618e+03 -1.276516e+04  2.892975e+03 -3.816568e+03 -3.133858e+03 
##           352           353           354           355           356 
## -5.447801e+03  2.319115e+03  1.884519e+03  3.197076e+03 -3.390650e+03 
##           357           358           359           360           361 
## -1.162528e+02  1.057067e+03  7.359901e+03  5.104786e+02  1.844598e+02 
##           362           363           364           365           366 
##  2.800205e+03 -2.571953e+03 -6.624878e+02 -8.520118e+03 -4.290305e+03 
##           367           368           369           370           371 
## -5.831487e+03 -4.507641e+03 -6.773809e+03  5.556291e+03  8.031305e+02 
##           372           373           374           375           376 
##  7.517050e+03 -7.359570e+03 -1.895190e+03 -3.010471e+03 -2.065921e+03 
##           377           378           379           380           381 
## -1.204764e+04  2.452739e+03 -1.015205e+04  6.284812e+03  9.800414e+03 
##           382           383           384           385           386 
##  3.430842e+03 -2.151918e+03  1.874441e+03  6.980565e+03  1.154790e+04 
##           387           388           389           390           391 
## -5.817394e+03 -5.283680e+03  7.621388e-01  8.723018e+03  1.858231e+03 
##           392           393           394           395           396 
##  1.125244e+04 -9.986755e+03  2.825834e+03  7.374633e+02  5.915263e+02 
##           397           398           399           400           401 
## -6.185768e+02 -5.058919e+02 -1.441159e+04  8.809778e+03 -1.018340e+03 
##           402           403           404           405           406 
## -1.190758e+03  7.182836e+03 -7.828811e+03 -1.074565e+03 -2.293411e+03 
##           407           408           409           410           411 
## -5.549518e+03 -2.515881e+03 -3.549642e+03 -8.352220e+03  6.633768e+03 
##           412           413           414           415           416 
##  2.020896e+03 -7.037928e+03 -7.272139e+03  1.472054e+04  4.080127e+03 
##           417           418           419           420           421 
##  4.689478e+03 -7.905906e+03 -4.497872e+03 -2.294811e+03  3.150081e+03 
##           422           423           424           425           426 
## -1.373501e+04 -2.331555e+03 -8.630089e+03  3.575988e+03  7.455442e+03 
##           427           428           429           430           431 
##  6.922504e+03 -3.751401e+03 -3.835532e+03 -4.390659e+03 -1.408636e+03 
##           432           433           434           435           436 
## -5.327687e+03 -6.185884e+03 -5.446481e+03 -8.445628e+02 -3.215595e+02 
##           437           438           439           440           441 
## -4.476403e+03  3.112545e+03  5.294655e+03 -4.699796e+03 -1.751531e+03 
##           442           443           444           445           446 
##  1.987554e+03 -3.473302e+03  3.231982e+03 -6.244509e+03 -1.170312e+04 
##           447           448           449           450           451 
## -3.963533e+03  1.021360e+04 -1.637986e+03  5.153552e+03 -5.558093e+03 
##           452           453           454           455           456 
## -7.439464e+02  7.575323e+02  3.375030e+03 -1.197763e+04  3.815543e+03 
##           457           458           459           460           461 
## -6.328736e+03  6.965453e+03  3.339385e+03  2.779013e+03 -3.615575e+03 
##           462           463 
##  2.372073e+03  2.351812e+02 
## 
## $fitted.values
##        2        3        4        5        6        7        8        9 
## 17195.37 20075.05 24377.59 24092.33 26472.56 23774.77 24499.26 19676.96 
##       10       11       12       13       14       15       16       17 
## 19410.51 16722.94 17509.28 14201.35 14253.09 14925.33 16641.28 14942.12 
##       18       19       20       21       22       23       24       25 
## 15988.60 15354.98 22518.26 21591.82 21065.74 22977.32 22295.61 22955.61 
##       26       27       28       29       30       31       32       33 
## 24822.63 18681.72 20427.58 28354.35 28412.66 28081.85 25684.20 27102.64 
##       34       35       36       37       38       39       40       41 
## 30989.54 31341.94 32767.20 30249.40 34190.41 37435.11 34457.61 31232.10 
##       42       43       44       45       46       47       48       49 
## 30066.72 20538.74 28143.28 30607.57 31709.21 38625.35 38114.16 42829.56 
##       50       51       52       53       54       55       56       57 
## 47114.17 39728.75 34235.22 29201.12 22267.30 28629.10 25170.71 21426.06 
##       58       59       60       61       62       63       64       65 
## 25884.73 27158.65 27459.05 27875.57 23699.38 40480.00 42345.01 37536.71 
##       66       67       68       69       70       71       72       73 
## 41791.66 46763.41 57553.33 55544.43 40619.22 38096.62 41148.96 35384.06 
##       74       75       76       77       78       79       80       81 
## 30784.40 21381.76 24619.77 20498.98 22608.85 17446.14 19484.57 18702.26 
##       82       83       84       85       86       87       88       89 
## 17718.90 15765.79 17058.14 20707.37 25175.51 26176.67 26201.91 26825.69 
##       90       91       92       93       94       95       96       97 
## 30997.84 29815.04 30825.80 28868.15 28058.84 28431.18 28842.40 22346.57 
##       98       99      100      101      102      103      104      105 
## 25396.01 18346.96 17190.04 15208.41 15511.59 16196.70 20720.37 19793.42 
##      106      107      108      109      110      111      112      113 
## 23344.58 23132.15 24827.39 27736.98 25206.55 21609.45 21888.02 24564.48 
##      114      115      116      117      118      119      120      121 
## 35552.94 33725.17 35583.61 38616.13 40594.36 38256.41 33018.34 29318.00 
##      122      123      124      125      126      127      128      129 
## 31424.58 29684.91 30879.95 38566.40 38204.79 37255.62 34083.38 35884.89 
##      130      131      132      133      134      135      136      137 
## 41344.35 40778.26 31879.60 33158.82 36384.97 32754.67 31123.55 30198.12 
##      138      139      140      141      142      143      144      145 
## 26715.88 28146.44 27913.44 25573.35 27620.86 26229.93 19759.09 22824.18 
##      146      147      148      149      150      151      152      153 
## 20626.09 23637.15 24183.30 25791.83 25975.98 27649.01 28964.58 32031.32 
##      154      155      156      157      158      159      160      161 
## 27449.84 26704.39 24231.77 30193.07 41157.10 39468.30 36803.20 41880.71 
##      162      163      164      165      166      167      168      169 
## 43305.34 46760.19 42174.42 37428.10 42915.20 59403.25 61640.60 60036.61 
##      170      171      172      173      174      175      176      177 
## 56826.12 55207.11 57940.50 56953.47 49157.71 52013.41 55798.70 55835.30 
##      178      179      180      181      182      183      184      185 
## 63045.41 53439.42 50153.33 40857.21 32300.10 35848.35 46067.00 45516.82 
##      186      187      188      189      190      191      192      193 
## 51537.44 57347.91 68253.82 73596.90 67219.71 67415.35 74566.25 70193.41 
##      194      195      196      197      198      199      200      201 
## 65665.20 54786.43 48748.51 50189.05 45733.53 37813.07 44311.05 42518.24 
##      202      203      204      205      206      207      208      209 
## 42152.08 42635.88 49507.34 58497.88 58123.27 59867.73 61542.40 65376.79 
##      210      211      212      213      214      215      216      217 
## 74951.22 66943.79 54998.22 49545.58 40439.30 37362.34 40511.50 30417.93 
##      218      219      220      221      222      223      224      225 
## 47584.91 54989.14 55901.32 78926.22 86506.65 88532.71 96210.58 87058.35 
##      226      227      228      229      230      231      232      233 
## 80988.38 80565.55 77177.34 76329.27 81120.28 82500.10 76872.14 72030.53 
##      234      235      236      237      238      239      240      241 
## 77748.60 64244.23 56189.98 48048.89 39564.86 43804.54 45981.80 39357.86 
##      242      243      244      245      246      247      248      249 
## 32965.40 43365.04 37546.37 41526.92 33702.64 32393.75 36090.69 38946.76 
##      250      251      252      253      254      255      256      257 
## 29671.72 35677.45 39522.19 44776.17 47525.46 47012.25 57430.58 75127.17 
##      258      259      260      261      262      263      264      265 
## 74940.11 68174.55 69673.27 65850.99 67313.61 61000.16 50152.57 46134.66 
##      266      267      268      269      270      271      272      273 
## 46346.45 42408.81 51313.27 47543.88 51737.87 49832.98 53946.70 54246.09 
##      274      275      276      277      278      279      280      281 
## 60332.09 57939.37 67722.56 61578.12 61790.54 60120.80 65929.12 59588.16 
##      282      283      284      285      286      287      288      289 
## 56112.86 45546.10 43924.57 61353.20 66946.32 67360.44 64748.60 63825.57 
##      290      291      292      293      294      295      296      297 
## 67872.13 71826.93 52606.89 42596.12 36538.89 46977.92 50256.70 49360.55 
##      298      299      300      301      302      303      304      305 
## 73832.67 79845.85 80521.12 85186.15 83364.19 78337.79 81844.14 56456.80 
##      306      307      308      309      310      311      312      313 
## 52675.30 52351.42 46070.79 43248.42 46892.85 39360.13 38067.65 32567.18 
##      314      315      316      317      318      319      320      321 
## 36394.88 35566.89 39442.05 37403.49 63483.89 61300.44 62942.54 71031.88 
##      322      323      324      325      326      327      328      329 
## 73446.44 99218.75 97577.91 73132.41 71916.55 70255.14 62115.05 59204.45 
##      330      331      332      333      334      335      336      337 
## 28810.03 32539.66 32984.20 35330.60 34663.92 40496.73 41584.60 36777.95 
##      338      339      340      341      342      343      344      345 
## 35983.41 36111.52 31377.06 37444.51 38115.49 38376.89 39262.69 41069.00 
##      346      347      348      349      350      351      352      353 
## 42911.79 42660.62 35524.73 25984.88 31390.57 30238.57 29823.94 27413.17 
##      354      355      356      357      358      359      360      361 
## 32145.48 35942.64 40457.22 38625.54 39900.22 42063.10 49542.81 50099.68 
##      362      363      364      365      366      367      368      369 
## 50303.65 52794.95 50249.63 49687.83 42249.02 39413.77 35547.07 33300.38 
##      370      371      372      373      374      375      376      377 
## 29313.14 36684.30 38997.38 46973.00 40875.76 40316.61 38837.21 38364.64 
##      378      379      380      381      382      383      384      385 
## 29127.98 33778.62 26750.90 35064.16 45515.30 49121.49 47375.13 49389.58 
##      386      387      388      389      390      391      392      393 
## 55680.81 65274.68 58408.39 52813.38 52538.98 60002.91 60532.27 69300.04 
##      394      395      396      397      398      399      400      401 
## 58281.17 59865.97 59421.05 58899.01 57368.61 56116.01 42723.22 51407.05 
##      402      403      404      405      406      407      408      409 
## 50396.04 49350.45 55824.95 48282.14 47585.41 45892.95 41520.74 40338.07 
##      410      411      412      413      414      415      416      417 
## 38379.79 32406.37 40369.25 43329.07 37940.42 32972.46 48014.30 51903.09 
##      418      419      420      421      422      423      424      425 
## 55877.33 48260.30 44541.53 43202.35 46829.87 35116.41 34842.52 29035.58 
##      426      427      428      429      430      431      432      433 
## 34689.41 43112.35 50083.40 46811.82 43846.95 40736.92 40623.83 37061.31 
##      434      435      436      437      438      439      440      441 
## 33155.48 30357.85 31951.99 33822.55 31804.31 36726.20 43002.80 39717.96 
##      442      443      444      445      446      447      448      449 
## 39420.59 42461.44 40323.30 44358.51 39550.97 30480.53 29304.68 40791.70 
##      450      451      452      453      454      455      456      457 
## 40469.59 46185.52 41771.66 42125.32 43764.40 47525.20 37283.46 42188.31 
##      458      459      460      461      462      463 
## 37559.12 45214.90 48775.27 51425.86 48117.93 50485.53 
## 
## $shapiro.test
## [1] 0
## 
## $levenes.test
## [1] 0
## 
## $autcorr
## [1] "No autocorrelation evidence"
## 
## $post_sums
## [1] "Post-Est Warning"
## 
## $adjr_sq
## [1] 0.858
## 
## $fstat.bootstrap
## 
## ORDINARY NONPARAMETRIC BOOTSTRAP
## 
## 
## Call:
## boot::boot(data = x, statistic = f.stat, R = Reps, formula = depvar ~ 
##     ., parallel = parr)
## 
## 
## Bootstrap Statistics :
##        original     bias    std. error
## t1*    4.577743  0.5553095    2.886802
## t2* 1621.515340 28.8859942  240.429393
## WARNING: All values of t3* are NA
## 
## $itsa.plot
## 
## $booted.ints
##       Parameter    Lower CI Median F-value   Upper CI
## 1 interrupt_var    1.253283       4.683335   10.50597
## 2    lag_depvar 1282.014643    1634.751605 2064.95691

Ahora con las tendencias descompuestas

require(zoo)
require(scales)
Gastos_casa %>%
    dplyr::mutate(fecha= lubridate::parse_date_time(fecha, c("%d/%m/%Y"),exact=T)) %>% 
    dplyr::mutate(fecha2=strftime(fecha, format = "%Y-W%V")) %>%
    dplyr::mutate(gastador=ifelse(gastador=="Andrés",1,0)) %>%
    dplyr::mutate(treat=ifelse(fecha2>"2019-W26",1,0)) %>% 
   dplyr::mutate(gasto= dplyr::case_when(gasto=="Arreglo"~"Otros",
                                        gasto=="Aspiradora"~"Otros",
                                        gasto=="aspiradora"~"Otros",
                                        gasto=="Chromecast"~"Otros",
                                        gasto=="Cookidoo"~"Comida",
                                        gasto=="Diosi"~"Mascota",
                                        gasto=="donaciones"~"Otros",
                                        gasto=="Easy"~"Otros",
                                        gasto=="Entel"~"Comunicaciones",
                                        gasto=="VTR"~"Comunicaciones",
                                        gasto=="filtro agua"~"Otros",
                                        gasto=="filtro piscina mspa"~"Otros",
                                        gasto=="Granola Wild Foods"~"Otros",
                                        gasto=="Gas"~"Gas o kerosene",
                                        gasto=="Kerosen"~"Gas o kerosene",
                                        gasto=="Matri Andrés Kogan"~"Otros",
                                        gasto=="Muebles ratan"~"Otros",
                                        gasto=="Netflix"~"Comunicaciones",
                                        gasto=="Nexium"~"Farmacia",
                                        gasto=="Pan Pepperino"~"Comida",
                                        gasto=="Parafina"~"Gas o kerosene",
                                        gasto=="Plata basurero"~"Otros",
                                        gasto=="Plata fiestas patrias basureros"~"Otros",                                        
                                        gasto=="Regalo chocolates"~"Otros",                                        
                                        gasto=="Remedio"~"Farmacia",
                                        gasto=="Remedios"~"Farmacia",
                                        gasto=="ropa tami"~"Otros",
                                        gasto=="Sopapo"~"Otros",
                                        gasto=="uber"~"Otros",
                                        gasto=="Tina"~"Otros",
                                        gasto=="Vacuna Influenza"~"Farmacia",
                                        gasto=="Wild Protein"~"Otros",
                                        gasto=="yaz"~"Farmacia",
                                        gasto=="Yaz"~"Farmacia",
                                        T~gasto)) %>% 
    dplyr::group_by(gastador, fecha,gasto, .drop=F) %>%
    #dplyr::mutate(fecha_simp=week(parse_date(fecha))) %>% 
#    dplyr::mutate(fecha_simp=tsibble::yearweek(fecha)) %>%#después de  diosi. Junio 24, 2019   
    summarise(monto=sum(monto)) %>% 
    dplyr::mutate(gastador_nombre=plyr::revalue(as.character(gastador), c("0" = "Tami", "1"="Andrés"))) %>% 
  ggplot2::ggplot(aes(x = fecha, y = monto, color=as.factor(gastador_nombre))) +
  #stat_summary(geom = "line", fun.y = median, size = 1, alpha=0.5, aes(color="blue")) +
  geom_line(size=1) +
  facet_grid(gasto~.)+
  #geom_text(aes(x = fech_ing_qrt, y = perc_dup-0.05, label = paste0(n)), vjust = -1,hjust = 0, angle=45, size=3) +

  geom_vline(xintercept = as.Date("2019-06-24"),linetype = "dashed") +
  labs(y="Gastos (en miles)",x="Semanas y Meses", subtitle="Interlineado, incorporación de la Diosi; Azul= Tami; Rojo= Andrés") +
  ggtitle( "Figura 6. Gastos Semanales por Gastador e ítem (media)") +
  scale_y_continuous(labels = f <- function(x) paste0(x/1000)) + 
  scale_color_manual(name = "Gastador", values= c("blue", "red"), labels = c("Tami", "Andrés")) +
  scale_x_yearweek(breaks = "1 month", minor_breaks = "1 week", labels=date_format("%m/%y")) +
  guides(color = F)+
  sjPlot::theme_sjplot2() +
  theme(axis.text.x = element_text(vjust = 0.5,angle = 35)) +
  theme(
    panel.border = element_blank(), 
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(), 
    axis.line = element_line(colour = "black")
    )

autoplot(forecast::mstl(Gastos_casa$monto, lambda = "auto",iterate=5000000,start = 
lubridate::decimal_date(as.Date("2019-03-03"))))

 # scale_x_continuous(breaks = seq(0,400,by=30))
msts <- forecast::msts(Gastos_casa$monto,seasonal.periods = c(7,30.5,365.25),start = 
lubridate::decimal_date(as.Date("2019-03-03")))
#tbats <- forecast::tbats(msts,use.trend = FALSE)
#plot(tbats, main="Multiple Season Decomposition")
library(forecast)
fit_month <- Gastos_casa %>%
    dplyr::mutate(fecha= lubridate::parse_date_time(fecha, c("%d/%m/%Y"),exact=T)) %>% 
    dplyr::mutate(fecha_month=strftime(fecha, format = "%Y-%m")) %>%
    dplyr::mutate(day=as.Date(as.character(lubridate::floor_date(fecha, "day"))))%>%
    dplyr::group_by(fecha_month)%>%
    summarise(gasto_total=sum(monto))%>%
  data.frame()

model_ets<-ets(fit_month$gasto_total, opt.crit = "mse")
#forecast::autoplot(forecast(model_ets, h = 2))

fit_tbats <- forecast::tbats(fit_month$gasto_total)
autplot<-forecast::autoplot(forecast::forecast(fit_tbats, h=2)) +
  theme_bw()
autplot

library(bsts)
library(CausalImpact)
ts_week_covid<-  
Gastos_casa %>%
    dplyr::mutate(fecha= lubridate::parse_date_time(fecha, c("%d/%m/%Y"),exact=T)) %>% 
    dplyr::mutate(fecha_week=strftime(fecha, format = "%Y-W%V")) %>%
    dplyr::mutate(day=as.Date(as.character(lubridate::floor_date(fecha, "day"))))%>%
    dplyr::group_by(fecha_week)%>%
    summarise(gasto_total=sum(monto,na.rm=T)/1000,min_day=min(day))%>%
    dplyr::ungroup() %>% 
    dplyr::mutate(covid=dplyr::case_when(min_day>=as.Date("2020-03-17")~1,TRUE~0))%>%
    dplyr::mutate(covid=as.factor(covid))%>%
    data.frame()


ts_week_covid$gasto_total_na<-ts_week_covid$gasto_total
post_resp<-ts_week_covid$gasto_total[which(ts_week_covid$covid==1)]
ts_week_covid$gasto_total_na[which(ts_week_covid$covid==1)]<-NA
ts_week_covid$gasto_total[which(ts_week_covid$covid==0)]
##  [1]  98.357   4.780  56.784  50.506  64.483  67.248  49.299  35.786  58.503
## [10]  64.083  20.148  73.476 127.004  81.551  69.599 134.446  58.936  26.145
## [19] 129.927 104.989 130.860  81.893  95.697  64.579 303.471 151.106  49.275
## [28]  76.293  33.940  83.071 119.512  20.942  58.055  71.728  44.090  33.740
## [37]  59.264  77.410  60.831  63.376  48.754 235.284  29.604 115.143  72.419
## [46]   5.980  80.063 149.178  69.918 107.601  72.724  63.203  99.681 130.309
## [55] 195.898 112.066
# Model 1
ssd <- list()
# Local trend, weekly-seasonal #https://qastack.mx/stats/209426/predictions-from-bsts-model-in-r-are-failing-completely - PUSE UN GENERALIZED LOCAL TREND
ssd <- AddLocalLevel(ssd, ts_week_covid$gasto_total_na) #AddSemilocalLinearTrend #AddLocalLevel
# Add weekly seasonal
ssd <- AddSeasonal(ssd, ts_week_covid$gasto_total_na,nseasons=5, season.duration = 52) #weeks OJO, ESTOS NO SON WEEKS VERDADEROS. PORQUE TENGO MAS DE EUN AÑO
ssd <- AddSeasonal(ssd, ts_week_covid$gasto_total_na, nseasons = 12, season.duration =4) #years
# For example, to add a day-of-week component to data with daily granularity, use model.args = list(nseasons = 7, season.duration = 1). To add a day-of-week component to data with hourly granularity, set model.args = list(nseasons = 7, season.duration = 24).
model1d1 <- bsts(ts_week_covid$gasto_total_na, 
               state.specification = ssd, #A list with elements created by AddLocalLinearTrend, AddSeasonal, and similar functions for adding components of state. See the help page for state.specification.
               family ="student", #A Bayesian Analysis of Time-Series Event Count Data. POISSON NO SE PUEDE OCUPAR
               niter = 20000, 
               #burn = 200, #http://finzi.psych.upenn.edu/library/bsts/html/SuggestBurn.html Suggest the size of an MCMC burn in sample as a proportion of the total run.
               seed= 2125)
## =-=-=-=-= Iteration 0 Fri Jul 01 14:59:28 2022
##  =-=-=-=-=
## =-=-=-=-= Iteration 2000 Fri Jul 01 14:59:34 2022
##  =-=-=-=-=
## =-=-=-=-= Iteration 4000 Fri Jul 01 14:59:41 2022
##  =-=-=-=-=
## =-=-=-=-= Iteration 6000 Fri Jul 01 14:59:47 2022
##  =-=-=-=-=
## =-=-=-=-= Iteration 8000 Fri Jul 01 14:59:53 2022
##  =-=-=-=-=
## =-=-=-=-= Iteration 10000 Fri Jul 01 15:00:00 2022
##  =-=-=-=-=
## =-=-=-=-= Iteration 12000 Fri Jul 01 15:00:06 2022
##  =-=-=-=-=
## =-=-=-=-= Iteration 14000 Fri Jul 01 15:00:13 2022
##  =-=-=-=-=
## =-=-=-=-= Iteration 16000 Fri Jul 01 15:00:19 2022
##  =-=-=-=-=
## =-=-=-=-= Iteration 18000 Fri Jul 01 15:00:25 2022
##  =-=-=-=-=
#,
#               dynamic.regression=T)
#plot(model1d1, main = "Model 1")
#plot(model1d1, "components")

impact2d1 <- CausalImpact(bsts.model = model1d1,
                       post.period.response = post_resp)
plot(impact2d1)+
xlab("Date")+
  ylab("Monto Semanal (En miles)")

burn1d1 <- SuggestBurn(0.1, model1d1)

  #plot(impact3d_ratio_resp)+
  #xlab("Date")+
  #ylab("Ratio")+
  #scale_x_continuous(breaks=(c(seq(1,nrow(data15a64_rn),12),262)),
  #                   labels=as.character(unlist(data15a64_rn[c(seq(1,nrow(data15a64_rn),12),262),"date"])))+
  #theme(axis.text.x = element_text(angle = 45, vjust = 0.5, hjust=.5,size=11),
  #      plot.caption = element_text(hjust = 0, face= "italic",size=9))+
  ##scale_y_continuous(labels=scales::percent)+
  #labs(caption="Note. The first panel shows the data and a counterfactual prediction for the post-treatment period (Blue dashed line);\nThe second panel shows the difference between observed data and counterfactual predictions;\nThe third panel adds up the pointwise contributions from the second panel;\nBlue area= Prediction intervals.")
  
#summary(impact2d1) 
##summary(impact2d1,"report")
#msts(data15a64_rn$hosp_trauma, seasonal.periods=c(7,365.25))
corpus <- Corpus(VectorSource(Gastos_casa$obs)) # formato de texto
d  <- tm_map(corpus, tolower)
d  <- tm_map(d, stripWhitespace)
d <- tm_map(d, removePunctuation)
d <- tm_map(d, removeNumbers)
d <- tm_map(d, removeWords, stopwords("spanish"))
d <- tm_map(d, removeWords, "menos")
tdm <- TermDocumentMatrix(d)
m <- as.matrix(tdm) #lo vuelve una matriz
v <- sort(rowSums(m),decreasing=TRUE) #lo ordena y suma
df <- data.frame(word = names(v),freq=v) # lo nombra y le da formato de data.frame
#findFreqTerms(tdm)
#require(devtools)
#install_github("lchiffon/wordcloud2")
#wordcloud2::wordcloud2(v, size=1.2)
wordcloud(words = df$word, freq = df$freq, 
          max.words=100, random.order=FALSE, rot.per=0.35, 
          colors=brewer.pal(8, "Dark2"), main="Figura 7. Nube de Palabras, Observaciones")

fit_month_gasto <- Gastos_casa %>%
    dplyr::mutate(fecha= lubridate::parse_date_time(fecha, c("%d/%m/%Y"),exact=T)) %>% 
    dplyr::mutate(fecha_month=strftime(fecha, format = "%Y-%m")) %>%
    dplyr::mutate(day=as.Date(as.character(lubridate::floor_date(fecha, "day"))))%>%
  dplyr::mutate(gasto= dplyr::case_when(gasto=="Arreglo"~"Otros",
                                        gasto=="Aspiradora"~"Otros",
                                        gasto=="aspiradora"~"Otros",
                                        gasto=="Chromecast"~"Otros",
                                        gasto=="Cookidoo"~"Comida",
                                        gasto=="Diosi"~"Mascota",
                                        gasto=="donaciones"~"Otros",
                                        gasto=="Easy"~"Otros",
                                        gasto=="Entel"~"Comunicaciones",
                                        gasto=="VTR"~"Comunicaciones",
                                        gasto=="filtro agua"~"Otros",
                                        gasto=="filtro piscina mspa"~"Otros",
                                        gasto=="Granola Wild Foods"~"Otros",
                                        gasto=="Gas"~"Gas o kerosene",
                                        gasto=="Kerosen"~"Gas o kerosene",
                                        gasto=="Matri Andrés Kogan"~"Otros",
                                        gasto=="Muebles ratan"~"Otros",
                                        gasto=="Netflix"~"Comunicaciones",
                                        gasto=="Nexium"~"Farmacia",
                                        gasto=="Pan Pepperino"~"Comida",
                                        gasto=="Parafina"~"Gas o kerosene",
                                        gasto=="Plata basurero"~"Otros",
                                        gasto=="Plata fiestas patrias basureros"~"Otros",                                        
                                        gasto=="Regalo chocolates"~"Otros",                                        
                                        gasto=="Remedio"~"Farmacia",
                                        gasto=="Remedios"~"Farmacia",
                                        gasto=="ropa tami"~"Otros",
                                        gasto=="Sopapo"~"Otros",
                                        gasto=="uber"~"Otros",
                                        gasto=="Tina"~"Otros",
                                        gasto=="Vacuna Influenza"~"Farmacia",
                                        gasto=="Wild Protein"~"Otros",
                                        gasto=="yaz"~"Farmacia",
                                        gasto=="Yaz"~"Farmacia",
                                        T~gasto)) %>% 
  dplyr::mutate(fecha_month=factor(fecha_month, levels=format(seq(from = as.Date("2019-03-03"), to = as.Date(substr(Sys.time(),1,10)), by = "1 month"),"%Y-%m")))%>% 
  dplyr::mutate(gasto=factor(gasto, levels=c("Agua", "Comida", "Comunicaciones","Electricidad", "Enceres", "Farmacia", "Gas o kerosene", "Mascota", "Otros")))%>% 
    dplyr::group_by(fecha_month, gasto, .drop=F)%>%
    dplyr::summarise(gasto_total=sum(monto, na.rm = T)/1000)%>%
  data.frame()

fit_month_gasto_21<-
fit_month_gasto %>% 
    #dplyr::filter()
    dplyr::filter(grepl("2021|2022",fecha_month)) %>% 
    #sacar el ultimo mes
    dplyr::filter(as.character(format(as.Date(substr(Sys.time(),1,10)),"%Y-%m"))!=fecha_month) %>% 
    dplyr::group_by(gasto) %>% 
    summarise(gasto_prom=mean(gasto_total, na.rm=T)) %>% 
  data.frame()


fit_month_gasto_20<-
fit_month_gasto %>% 
    #dplyr::filter()
    dplyr::filter(grepl("202",fecha_month)) %>% 
    #sacar el ultimo mes
    dplyr::filter(as.character(format(as.Date(substr(Sys.time(),1,10)),"%Y-%m"))!=fecha_month) %>% 
    dplyr::group_by(gasto) %>% 
    summarise(gasto_prom=mean(gasto_total, na.rm=T)) %>% 
  data.frame()

bind_cols(
bind_rows(fit_month_gasto_21,cbind.data.frame(gasto="Total",gasto_prom=sum(fit_month_gasto_21$gasto_prom))),
bind_rows(fit_month_gasto_20,cbind.data.frame(gasto="Total",gasto_prom=sum(fit_month_gasto_20$gasto_prom)))) %>% 
  dplyr::select(-3) %>% 
  knitr::kable(format="html", caption="Tabla. Gastos promedio por ítem a contar del...",
               col.names= c("Item","Gasto... 2021","Gasto... 2020")) %>% 
  kableExtra::kable_classic(bootstrap_options = c("striped", "hover"),font_size = 12) %>%
  kableExtra::scroll_box(width = "100%", height = "375px")
Tabla. Gastos promedio por ítem a contar del…
Item Gasto… 2021 Gasto… 2020
Agua 6.342333 7.78050
Comida 308.922111 342.52673
Comunicaciones 29.530278 28.66257
Electricidad 32.052667 27.47343
Enceres 13.505778 23.70827
Farmacia 9.330722 11.21313
Gas o kerosene 25.946889 22.47147
Mascota 39.631167 38.62723
Otros 53.555667 39.40570
NA 23.952750 23.95275
Total 542.770361 565.82178